xref: /llvm-project/clang/test/SemaObjC/weak-property.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1  -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -verify -Wno-objc-root-class %s
2
3@interface WeakPropertyTest {
4    Class isa;
5    __weak id value;
6    id x; // expected-error {{existing instance variable 'x' for __weak property 'x' must be __weak}}
7}
8@property (weak) id value1;
9@property __weak id value;
10@property () __weak id value2;
11
12@property (weak, assign) id v1;  // expected-error {{property attributes 'assign' and 'weak' are mutually exclusive}}
13@property (weak, copy) id v2; // expected-error {{property attributes 'copy' and 'weak' are mutually exclusive}}
14@property (weak, retain) id v3; // expected-error {{property attributes 'retain' and 'weak' are mutually exclusive}}
15@property (weak, assign) id v4;  // expected-error {{property attributes 'assign' and 'weak' are mutually exclusive}}
16
17@property () __weak id x; // expected-note {{property declared here}}
18@end
19
20@implementation WeakPropertyTest
21@synthesize x; // expected-note {{property synthesized here}}
22@dynamic value1, value, value2, v1,v2,v3,v4;
23@end
24