1// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s 2 3#define nil (void *)0; 4 5extern void foo(); 6 7@protocol MyProtocol 8- (void) method; 9@end 10 11@interface MyClass 12@end 13 14@interface MyClass (Addition) <MyProtocol> 15- (void) method; 16@end 17 18@interface MyOtherClass : MyClass 19@end 20 21int main() 22{ 23 id <MyProtocol> obj_id_p = nil; 24 MyClass *obj_c_cat_p = nil; 25 MyOtherClass *obj_c_super_p = nil; 26 MyOtherClass<MyProtocol> *obj_c_super_p_q = nil; 27 MyClass<MyProtocol> *obj_c_cat_p_q = nil; 28 29 obj_c_cat_p = obj_id_p; 30 obj_c_super_p = obj_id_p; 31 obj_id_p = obj_c_cat_p; /* Ok */ 32 obj_id_p = obj_c_super_p; /* Ok */ 33 34 if (obj_c_cat_p == obj_id_p) foo(); /* Ok */ 35 if (obj_c_super_p == obj_id_p) foo() ; /* Ok */ 36 if (obj_id_p == obj_c_cat_p) foo(); /* Ok */ 37 if (obj_id_p == obj_c_super_p) foo(); /* Ok */ 38 39 obj_c_cat_p = obj_c_super_p; // ok. 40 obj_c_cat_p = obj_c_super_p_q; // ok. 41 obj_c_super_p = obj_c_cat_p_q; // expected-warning {{incompatible pointer types}} 42 obj_c_cat_p_q = obj_c_super_p; 43 return 0; 44} 45