diff options
Diffstat (limited to 'clang/test/SemaObjC/class-method-self.m')
-rw-r--r-- | clang/test/SemaObjC/class-method-self.m | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/class-method-self.m b/clang/test/SemaObjC/class-method-self.m new file mode 100644 index 0000000..b1e37bf --- /dev/null +++ b/clang/test/SemaObjC/class-method-self.m @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -verify -Wno-objc-root-class %s + +typedef struct objc_class *Class; +@interface XX + +- (void)addObserver:(XX*)o; // expected-note 2{{passing argument to parameter 'o' here}} + +@end + +@interface YY + ++ (void)classMethod; + +@end + +@implementation YY + +static XX *obj; + ++ (void)classMethod { + [obj addObserver:self]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} + Class whatever; + [obj addObserver:whatever]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} +} +@end + |