71 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3@protocol Fooable4- (void)foo;5@end6 7@protocol SubFooable <Fooable>8@end9 10@interface AClass11@end12 13@interface BClass : AClass <SubFooable>14@end15 16@implementation BClass17- (void)foo {18}19@end20 21void functionTakingAClassConformingToAProtocol(AClass <Fooable> *instance) { // expected-note {{passing argument to parameter 'instance' here}}22}23 24int main (void) {25 AClass *aobject = 0;26 BClass *bobject = 0;27 functionTakingAClassConformingToAProtocol(aobject); // expected-error {{incompatible pointer types passing 'AClass *' to parameter of type 'AClass<Fooable> *'}}28 functionTakingAClassConformingToAProtocol(bobject); // Shouldn't warn - does implement Fooable29 return 0;30}31 32@interface NSObject @end33 34@protocol MyProtocol35@end36 37@interface MyClass : NSObject 38{39}40@end41 42@implementation MyClass43@end44 45@interface MySubclass : MyClass <MyProtocol> 46{47}48@end49 50@interface MyTestClass : NSObject51{52@private53 NSObject <MyProtocol> *someObj;54}55 56@property (nonatomic, assign) NSObject <MyProtocol> *someObj;57 58@end59 60@implementation MyTestClass61 62@synthesize someObj;63 64- (void)someMethod65{66 MySubclass *foo;67 [self setSomeObj:foo]; // no warning here!68}69 70@end71