1 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
14 @interface MyClass (Addition) <MyProtocol>
18 @interface MyOtherClass : MyClass
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;
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 */
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 */
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;