1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify -Wno-objc-root-class %s 2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fsyntax-only -fobjc-gc -verify -Wno-objc-root-class %s 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambucstruct S { 5*f4a2713aSLionel Sambuc __weak id w; // expected-warning {{__weak attribute cannot be specified on a field declaration}} 6*f4a2713aSLionel Sambuc __strong id p1; 7*f4a2713aSLionel Sambuc}; 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc@interface I 10*f4a2713aSLionel Sambuc{ 11*f4a2713aSLionel Sambuc __weak id w; // OK 12*f4a2713aSLionel Sambuc __strong id LHS; 13*f4a2713aSLionel Sambuc} 14*f4a2713aSLionel Sambuc- (void) foo; 15*f4a2713aSLionel Sambuc@end 16*f4a2713aSLionel Sambuc@implementation I 17*f4a2713aSLionel Sambuc- (void) foo { w = 0; LHS = w; } 18*f4a2713aSLionel Sambuc@end 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambucint main () 21*f4a2713aSLionel Sambuc{ 22*f4a2713aSLionel Sambuc struct I { 23*f4a2713aSLionel Sambuc __weak id w1; // expected-warning {{__weak attribute cannot be specified on a field declaration}} 24*f4a2713aSLionel Sambuc }; 25*f4a2713aSLionel Sambuc} 26