diff options
Diffstat (limited to 'test/SemaObjC/synchronized.m')
-rw-r--r-- | test/SemaObjC/synchronized.m | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/SemaObjC/synchronized.m b/test/SemaObjC/synchronized.m new file mode 100644 index 000000000000..7131265b5bb7 --- /dev/null +++ b/test/SemaObjC/synchronized.m @@ -0,0 +1,23 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +@interface PBXTrackableTaskManager @end + +@implementation PBXTrackableTaskManager +- (id) init {} +- (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)}} + } +} |