1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 //rdar: //8591619 3 // pr8453 4 5 @protocol NSCopying @end 6 @protocol NSPROTO @end 7 @protocol NSPROTO1 @end 8 @protocol NSPROTO2 @end 9 10 @interface NSObject <NSCopying, NSPROTO, NSPROTO1> { 11 Class isa; 12 } 13 @end 14 15 void gorf(NSObject <NSCopying> *); // expected-note {{passing argument to parameter here}} 16 17 NSObject <NSCopying> *foo(id <NSCopying> bar, id id_obj) 18 { 19 NSObject <NSCopying> *Init = bar; // expected-warning {{initializing 'NSObject<NSCopying> *' with an expression of incompatible type 'id<NSCopying>'}} 20 NSObject *Init1 = bar; // expected-warning {{initializing 'NSObject *' with an expression of incompatible type 'id<NSCopying>'}} 21 22 NSObject <NSCopying> *I = id_obj; 23 NSObject *I1 = id_obj; 24 gorf(bar); // expected-warning {{passing 'id<NSCopying>' to parameter of incompatible type 'NSObject<NSCopying> *'}} 25 26 gorf(id_obj); 27 28 return bar; // expected-warning {{returning 'id<NSCopying>' from a function with incompatible result type 'NSObject<NSCopying> *'}} 29 } 30 31 void test(id <NSCopying, NSPROTO, NSPROTO2> bar) 32 { 33 NSObject <NSCopying> *Init = bar; // expected-warning {{initializing 'NSObject<NSCopying> *' with an expression of incompatible type 'id<NSCopying,NSPROTO,NSPROTO2>'}} 34 } 35 36 // rdar://8843851 37 @interface NSObject (CAT) 38 + (struct S*)Meth : (struct S*)arg; 39 @end 40 41 struct S { 42 char *types; 43 }; 44 45 @interface I 46 @end 47 48 @implementation I 49 - (struct S *)Meth : (struct S*)a { 50 return [NSObject Meth : a]; 51 } 52 @end 53