1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
3 typedef struct CGColor * __attribute__ ((NSObject)) CGColorRef;
4 typedef struct CGColor * __attribute__((NSObject(12))) Illegal; // expected-error {{'NSObject' attribute takes no arguments}}
7 static CGColorRef tmp = 0;
9 typedef struct S1 __attribute__ ((NSObject)) CGColorRef1; // expected-error {{'NSObject' attribute is for pointer types only}}
10 typedef void * __attribute__ ((NSObject)) CGColorRef2; // no-warning
11 typedef void * CFTypeRef;
13 @interface HandTested {
18 @property(copy) CGColorRef x;
19 typedef struct CGColor * __attribute__((NSObject)) CGColorRefNoNSObject; // no-warning
20 @property (nonatomic, retain) CGColorRefNoNSObject color;
21 @property (strong) __attribute__((NSObject)) CFTypeRef myObj; // no-warning
22 @property (strong, nullable) CGColorRefNoNSObject color2; // no-warning
25 void setProperty(id self, id value) {
26 ((HandTested *)self)->x = value;
29 id getProperty(id self) {
30 return (id)((HandTested *)self)->x;
33 @implementation HandTested
39 int main(int argc, char *argv[]) {
49 __attribute__((NSObject)) void * color; // expected-warning {{'NSObject' attribute may be put on a typedef only; attribute is ignored}}
51 @property (nonatomic, retain) __attribute__((NSObject)) CGColorRefNoNSObject color; // // no-warning
53 void test_10453342(void) {
54 char* __attribute__((NSObject)) string2 = 0; // expected-warning {{'NSObject' attribute may be put on a typedef only; attribute is ignored}}
57 @interface A { int i; }
58 @property(retain) __attribute__((NSObject)) int i; // expected-error {{'NSObject' attribute is for pointer types only}} \
59 // expected-error {{property with 'retain (or strong)' attribute must be of object type}}