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