1*67e74705SXin Li// RUN: %clang_cc1 %s -fsyntax-only -verify 2*67e74705SXin Li// RUN: %clang_cc1 -x objective-c++ %s -fsyntax-only -verify 3*67e74705SXin Li 4*67e74705SXin Li// rdar://6497242 Inherited overridden protocol declared objects don't work 5*67e74705SXin Li// rdar://9740328 Case for c++ 6*67e74705SXin Li 7*67e74705SXin Li@protocol NSObject @end 8*67e74705SXin Li@interface NSObject @end 9*67e74705SXin Li 10*67e74705SXin Li@protocol FooDelegate<NSObject> 11*67e74705SXin Li@optional 12*67e74705SXin Li- (void)fooTask; 13*67e74705SXin Li@end 14*67e74705SXin Li 15*67e74705SXin Li@protocol BarDelegate<NSObject, FooDelegate> 16*67e74705SXin Li@optional 17*67e74705SXin Li- (void)barTask; 18*67e74705SXin Li@end 19*67e74705SXin Li 20*67e74705SXin Li@interface Foo : NSObject { 21*67e74705SXin Li id _delegate; 22*67e74705SXin Li} 23*67e74705SXin Li@property(nonatomic, assign) id<FooDelegate> delegate; 24*67e74705SXin Li@property(nonatomic, assign) id<BarDelegate> delegate2; // expected-note {{property declared here}} 25*67e74705SXin Li@end 26*67e74705SXin Li@interface Bar : Foo { 27*67e74705SXin Li} 28*67e74705SXin Li@property(nonatomic, assign) id<BarDelegate> delegate; 29*67e74705SXin Li@property(nonatomic, assign) id<FooDelegate> delegate2; // expected-warning{{property type 'id<FooDelegate>' is incompatible with type 'id<BarDelegate>' inherited from 'Foo'}} 30*67e74705SXin Li@end 31*67e74705SXin Li 32*67e74705SXin Li@interface NSData @end 33*67e74705SXin Li 34*67e74705SXin Li@interface NSMutableData : NSData @end 35*67e74705SXin Li 36*67e74705SXin Li@interface Base : NSData 37*67e74705SXin Li@property(assign) id ref; 38*67e74705SXin Li@property(assign) Base *p_base; 39*67e74705SXin Li@property(assign) NSMutableData *p_data; // expected-note {{property declared here}} 40*67e74705SXin Li@end 41*67e74705SXin Li 42*67e74705SXin Li@interface Data : Base 43*67e74705SXin Li@property(assign) NSData *ref; 44*67e74705SXin Li@property(assign) Data *p_base; 45*67e74705SXin Li@property(assign) NSData *p_data; // expected-warning{{property type 'NSData *' is incompatible with type 'NSMutableData *' inherited from 'Base'}} 46*67e74705SXin Li@end 47*67e74705SXin Li 48*67e74705SXin Li// rdar://15967517 49*67e74705SXin Li@protocol P1 50*67e74705SXin Li@property (nonatomic) void* selected; 51*67e74705SXin Li@end 52*67e74705SXin Li 53*67e74705SXin Li@protocol P2 54*67e74705SXin Li@property (nonatomic) void* selected; // expected-note {{property declared here}} 55*67e74705SXin Li@end 56*67e74705SXin Li 57*67e74705SXin Li@interface MKAnnotationView <P1> 58*67e74705SXin Li@property (nonatomic) void* selected; // expected-note {{property declared here}} 59*67e74705SXin Li@property (nonatomic) char selected2; 60*67e74705SXin Li@end 61*67e74705SXin Li 62*67e74705SXin Li@interface Parent : MKAnnotationView <P2> 63*67e74705SXin Li@property (nonatomic) void* selected1; // expected-note {{property declared here}} 64*67e74705SXin Li@property (nonatomic) char selected2; 65*67e74705SXin Li@end 66*67e74705SXin Li 67*67e74705SXin Li@interface Child : Parent 68*67e74705SXin Li@property (nonatomic) char selected; // expected-warning {{property type 'char' is incompatible with type 'void *' inherited from 'MKAnnotationView'}} \ 69*67e74705SXin Li // expected-warning {{property type 'char' is incompatible with type 'void *' inherited from 'P2'}} 70*67e74705SXin Li@property (nonatomic) char selected1; // expected-warning {{property type 'char' is incompatible with type 'void *' inherited from 'Parent'}} 71*67e74705SXin Li@property (nonatomic) char selected2; 72*67e74705SXin Li@end 73