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