1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 // rdar://9091389 3 4 @protocol Fooable 5 - (void)foo; 6 @end 7 8 @protocol SubFooable <Fooable> 9 @end 10 11 @interface AClass 12 @end 13 14 @interface BClass : AClass <SubFooable> 15 @end 16 17 @implementation BClass 18 - (void)foo { 19 } 20 @end 21 22 void functionTakingAClassConformingToAProtocol(AClass <Fooable> *instance) { // expected-note {{passing argument to parameter 'instance' here}} 23 } 24 25 int main () { 26 AClass *aobject = 0; 27 BClass *bobject = 0; 28 functionTakingAClassConformingToAProtocol(aobject); // expected-warning {{incompatible pointer types passing 'AClass *' to parameter of type 'AClass<Fooable> *'}} 29 functionTakingAClassConformingToAProtocol(bobject); // Shouldn't warn - does implement Fooable 30 return 0; 31 } 32 33 // rdar://9267196 34 @interface NSObject @end 35 36 @protocol MyProtocol 37 @end 38 39 @interface MyClass : NSObject 40 { 41 } 42 @end 43 44 @implementation MyClass 45 @end 46 47 @interface MySubclass : MyClass <MyProtocol> 48 { 49 } 50 @end 51 52 @interface MyTestClass : NSObject 53 { 54 @private 55 NSObject <MyProtocol> *someObj; 56 } 57 58 @property (nonatomic, assign) NSObject <MyProtocol> *someObj; 59 60 @end 61 62 @implementation MyTestClass 63 64 @synthesize someObj; 65 66 - (void)someMethod 67 { 68 MySubclass *foo; 69 [self setSomeObj:foo]; // no warning here! 70 } 71 72 @end 73