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 | |
| 10 | @interface HandTested { |
| 11 | @public |
| 12 | CGColorRef x; |
| 13 | } |
| 14 | @property(copy) CGColorRef x; |
| 15 | @end |
| 16 | |
| 17 | void setProperty(id self, id value) { |
| 18 | ((HandTested *)self)->x = value; |
| 19 | } |
| 20 | |
| 21 | id getProperty(id self) { |
| 22 | return (id)((HandTested *)self)->x; |
| 23 | } |
| 24 | |
| 25 | @implementation HandTested |
| 26 | @synthesize x=x; |
| 27 | @end |
| 28 | |
John McCall | 13591ed | 2009-07-25 04:36:53 +0000 | [diff] [blame] | 29 | int main(int argc, char *argv[]) { |
Fariborz Jahanian | fa23c1d | 2009-01-13 23:34:40 +0000 | [diff] [blame] | 30 | HandTested *to; |
| 31 | to.x = tmp; // setter |
| 32 | if (tmp != to.x) |
| 33 | to.x = tmp; |
| 34 | return 0; |
| 35 | } |
| 36 | |