1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s 2 3 typedef struct CGColor * __attribute__ ((NSObject)) CGColorRef; 4 static int count; 5 static CGColorRef tmp = 0; 6 7 typedef struct S1 __attribute__ ((NSObject)) CGColorRef1; // expected-error {{__attribute ((NSObject)) is for pointer types only}} 8 typedef void * __attribute__ ((NSObject)) CGColorRef2; // no-warning 9 typedef void * CFTypeRef; 10 11 @interface HandTested { 12 @public 13 CGColorRef x; 14 } 15 16 @property(copy) CGColorRef x; 17 // rdar://problem/7809460 18 typedef struct CGColor * __attribute__((NSObject)) CGColorRefNoNSObject; // no-warning 19 @property (nonatomic, retain) CGColorRefNoNSObject color; 20 // rdar://problem/12197822 21 @property (strong) __attribute__((NSObject)) CFTypeRef myObj; // no-warning 22 @end 23 24 void setProperty(id self, id value) { 25 ((HandTested *)self)->x = value; 26 } 27 28 id getProperty(id self) { 29 return (id)((HandTested *)self)->x; 30 } 31 32 @implementation HandTested 33 @synthesize x=x; 34 @synthesize myObj; 35 @dynamic color; 36 @end 37 38 int main(int argc, char *argv[]) { 39 HandTested *to; 40 to.x = tmp; // setter 41 if (tmp != to.x) 42 to.x = tmp; 43 return 0; 44 } 45 46 // rdar://10453342 47 @interface I 48 { 49 __attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}} 50 } 51 // <rdar://problem/10930507> 52 @property (nonatomic, retain) __attribute__((NSObject)) CGColorRefNoNSObject color; // // no-warning 53 @end 54 void test_10453342() { 55 char* __attribute__((NSObject)) string2 = 0; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}} 56 } 57 58 // rdar://11569860 59 @interface A { int i; } 60 @property(retain) __attribute__((NSObject)) int i; // expected-error {{__attribute ((NSObject)) is for pointer types only}} \ 61 // expected-error {{property with 'retain (or strong)' attribute must be of object type}} 62 @end 63 64 @implementation A 65 @synthesize i; 66 @end 67 68