Daniel Dunbar | 02022f4 | 2009-04-10 21:23:20 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify %s |
Fariborz Jahanian | 80b0b42 | 2008-11-20 18:10:58 +0000 | [diff] [blame] | 2 | |
| 3 | struct S { |
| 4 | __weak id w; // expected-warning {{__weak attribute cannot be specified on a field declaration}} |
| 5 | __strong id p1; |
| 6 | }; |
| 7 | |
Fariborz Jahanian | 24b93f2 | 2008-11-20 19:35:51 +0000 | [diff] [blame] | 8 | @interface I |
| 9 | { |
| 10 | __weak id w; // OK |
| 11 | __strong id LHS; |
| 12 | } |
| 13 | - (void) foo; |
| 14 | @end |
| 15 | @implementation I |
| 16 | - (void) foo { w = 0; LHS = w; } |
| 17 | @end |
| 18 | |
Fariborz Jahanian | 80b0b42 | 2008-11-20 18:10:58 +0000 | [diff] [blame] | 19 | int main () |
| 20 | { |
| 21 | struct I { |
| 22 | __weak id w1; // expected-warning {{__weak attribute cannot be specified on a field declaration}} |
| 23 | }; |
| 24 | } |