Changeset View
Changeset View
Standalone View
Standalone View
clang/test/SemaObjC/class-method-self.m
// RUN: %clang_cc1 -verify -Wno-objc-root-class %s | // RUN: %clang_cc1 -verify -Wno-objc-root-class %s | ||||
typedef struct objc_class *Class; | |||||
@interface XX | @interface XX | ||||
- (void)addObserver:(XX*)o; // expected-note 2{{passing argument to parameter 'o' here}} | - (void)addObserver:(XX*)o; // expected-note 2{{passing argument to parameter 'o' here}} | ||||
@end | @end | ||||
@interface YY | @interface YY | ||||
+ (void)classMethod; | + (void)classMethod; | ||||
@end | @end | ||||
@implementation YY | @implementation YY | ||||
static XX *obj; | static XX *obj; | ||||
+ (void)classMethod { | + (void)classMethod { | ||||
[obj addObserver:self]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} | [obj addObserver:self]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} | ||||
Class whatever; | Class whatever; | ||||
[obj addObserver:whatever]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} | [obj addObserver:whatever]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} | ||||
} | } | ||||
@end | @end | ||||