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; // expected-error {{__attribute ((NSObject)) is for pointer types only}} 9 10 11 @interface HandTested { 12 @public 13 CGColorRef x; 14 } 15 16 @property(copy) CGColorRef x; 17 // rdar: // 7809460 18 typedef struct CGColor * __attribute__((NSObject)) CGColorRefNoNSObject; 19 @property (nonatomic, retain) CGColorRefNoNSObject color; 20 @end 21 22 void setProperty(id self, id value) { 23 ((HandTested *)self)->x = value; 24 } 25 26 id getProperty(id self) { 27 return (id)((HandTested *)self)->x; 28 } 29 30 @implementation HandTested 31 @synthesize x=x; 32 @dynamic color; 33 @end 34 35 int main(int argc, char *argv[]) { 36 HandTested *to; 37 to.x = tmp; // setter 38 if (tmp != to.x) 39 to.x = tmp; 40 return 0; 41 } 42 43 // rdar://10453342 44 @interface I 45 { 46 __attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}} 47 } 48 // <rdar://problem/10930507> 49 @property (nonatomic, retain) __attribute__((NSObject)) void * color; // // no-warning 50 @end 51 void test_10453342() { 52 char* __attribute__((NSObject)) string2 = 0; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}} 53 } 54 55