xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/error-property-gc-attr.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify -Wno-objc-root-class %s
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fobjc-gc -fsyntax-only -verify -Wno-objc-root-class %s
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc@interface INTF
5*f4a2713aSLionel Sambuc{
6*f4a2713aSLionel Sambuc  id IVAR; // expected-note {{instance variable is declared here}}
7*f4a2713aSLionel Sambuc  __weak id II;
8*f4a2713aSLionel Sambuc  __weak id WID;
9*f4a2713aSLionel Sambuc  id ID;
10*f4a2713aSLionel Sambuc  __weak INTF* AWEAK;
11*f4a2713aSLionel Sambuc  __weak INTF* WI;
12*f4a2713aSLionel Sambuc}
13*f4a2713aSLionel Sambuc@property (assign) __weak id pweak;
14*f4a2713aSLionel Sambuc@property (assign) __weak id WID;
15*f4a2713aSLionel Sambuc@property (assign) __strong id NOT;
16*f4a2713aSLionel Sambuc@property (assign)  id ID;
17*f4a2713aSLionel Sambuc@property (assign) INTF* AWEAK;
18*f4a2713aSLionel Sambuc@property (assign) __weak INTF* WI;
19*f4a2713aSLionel Sambuc@end
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambuc@implementation INTF
22*f4a2713aSLionel Sambuc@synthesize pweak=IVAR;  // expected-error {{existing instance variable 'IVAR' for __weak property 'pweak' must be __weak}}
23*f4a2713aSLionel Sambuc@synthesize NOT=II; // expected-error {{existing instance variable 'II' for strong property 'NOT' may not be __weak}}
24*f4a2713aSLionel Sambuc@synthesize WID;
25*f4a2713aSLionel Sambuc@synthesize ID;
26*f4a2713aSLionel Sambuc@synthesize AWEAK; // expected-error {{existing instance variable 'AWEAK' for strong property 'AWEAK' may not be __weak}}
27*f4a2713aSLionel Sambuc@synthesize WI;
28*f4a2713aSLionel Sambuc@end
29