| Daniel Dunbar | 8fbe78f | 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 | d4081c6 | 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 | c1877cb | 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 | d4081c6 | 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 | } |