summaryrefslogtreecommitdiff
path: root/clang/test/SemaObjC/synchronized.m
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaObjC/synchronized.m')
-rw-r--r--clang/test/SemaObjC/synchronized.m23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/synchronized.m b/clang/test/SemaObjC/synchronized.m
new file mode 100644
index 0000000..c158815
--- /dev/null
+++ b/clang/test/SemaObjC/synchronized.m
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+
+@interface PBXTrackableTaskManager @end
+
+@implementation PBXTrackableTaskManager
+- (id) init { return 0; }
+- (void) unregisterTask:(id) task {
+ @synchronized (self) {
+ id taskID = [task taskIdentifier]; // expected-warning {{method '-taskIdentifier' not found (return type defaults to 'id')}}
+ }
+}
+@end
+
+
+struct x { int a; } b;
+
+void test1() {
+ @synchronized (b) { // expected-error {{@synchronized requires an Objective-C object type ('struct x' invalid)}}
+ }
+
+ @synchronized (42) { // expected-error {{@synchronized requires an Objective-C object type ('int' invalid)}}
+ }
+}