Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | fa23c1d | 2009-01-13 23:34:40 +0000 | [diff] [blame] | 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 | |
Fariborz Jahanian | 842f07b | 2010-03-30 22:40:11 +0000 | [diff] [blame] | 10 | |
Fariborz Jahanian | fa23c1d | 2009-01-13 23:34:40 +0000 | [diff] [blame] | 11 | @interface HandTested { |
| 12 | @public |
| 13 | CGColorRef x; |
| 14 | } |
Fariborz Jahanian | 842f07b | 2010-03-30 22:40:11 +0000 | [diff] [blame] | 15 | |
Fariborz Jahanian | fa23c1d | 2009-01-13 23:34:40 +0000 | [diff] [blame] | 16 | @property(copy) CGColorRef x; |
Fariborz Jahanian | 842f07b | 2010-03-30 22:40:11 +0000 | [diff] [blame] | 17 | // rdar: // 7809460 |
| 18 | typedef struct CGColor *CGColorRefNoNSObject; |
| 19 | @property (nonatomic, retain) __attribute__((NSObject)) CGColorRefNoNSObject color; |
Fariborz Jahanian | fa23c1d | 2009-01-13 23:34:40 +0000 | [diff] [blame] | 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; |
Fariborz Jahanian | 842f07b | 2010-03-30 22:40:11 +0000 | [diff] [blame] | 32 | @dynamic color; |
Fariborz Jahanian | fa23c1d | 2009-01-13 23:34:40 +0000 | [diff] [blame] | 33 | @end |
| 34 | |
John McCall | 13591ed | 2009-07-25 04:36:53 +0000 | [diff] [blame] | 35 | int main(int argc, char *argv[]) { |
Fariborz Jahanian | fa23c1d | 2009-01-13 23:34:40 +0000 | [diff] [blame] | 36 | HandTested *to; |
| 37 | to.x = tmp; // setter |
| 38 | if (tmp != to.x) |
| 39 | to.x = tmp; |
| 40 | return 0; |
| 41 | } |
| 42 | |