Debian Codegraph @

clang/test/SemaObjC/property-10.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
2
3 // Check property attribute consistency.
4
5 @interface I0
6 @property(readonly, readwrite) int p0; // expected-error {{property attributes 'readonly' and 'readwrite' are mutually exclusive}}
7
8 @property(retain) int p1; // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
9 @property(strong) int s1; // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
10
11 @property(copy) int p2; // expected-error {{property with 'copy' attribute must be of object type}}
12
13 @property(assign, copy) id p3_0; // expected-error {{property attributes 'assign' and 'copy' are mutually exclusive}}
14 @property(assign, retain) id p3_1; // expected-error {{property attributes 'assign' and 'retain' are mutually exclusive}}
15 @property(assign, strong) id s3_1; // expected-error {{property attributes 'assign' and 'strong' are mutually exclusive}}
16 @property(copy, retain) id p3_2; // expected-error {{property attributes 'copy' and 'retain' are mutually exclusive}}
17 @property(copy, strong) id s3_2; // expected-error {{property attributes 'copy' and 'strong' are mutually exclusive}}
18 @property(assign, copy, retain) id p3_3; // expected-error {{property attributes 'assign' and 'copy' are mutually exclusive}}, expected-error {{property attributes 'assign' and 'retain' are mutually exclusive}}
19 @property(assign, copy, strong) id s3_3; // expected-error {{property attributes 'assign' and 'copy' are mutually exclusive}}, expected-error {{property attributes 'assign' and 'strong' are mutually exclusive}}
20
21 @property(unsafe_unretained, copy) id p4_0; // expected-error {{property attributes 'unsafe_unretained' and 'copy' are mutually exclusive}}
22 @property(unsafe_unretained, retain) id p4_1; // expected-error {{property attributes 'unsafe_unretained' and 'retain' are mutually exclusive}}
23 @property(unsafe_unretained, strong) id s4_1; // expected-error {{property attributes 'unsafe_unretained' and 'strong' are mutually exclusive}}
24 @property(unsafe_unretained, copy, retain) id p4_3; // expected-error {{property attributes 'unsafe_unretained' and 'copy' are mutually exclusive}}, expected-error {{property attributes 'unsafe_unretained' and 'retain' are mutually exclusive}}
25 @property(unsafe_unretained, copy, strong) id s4_3; // expected-error {{property attributes 'unsafe_unretained' and 'copy' are mutually exclusive}}, expected-error {{property attributes 'unsafe_unretained' and 'strong' are mutually exclusive}}
26
27 @property id p4; // expected-warning {{no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed}}, expected-warning {{default property attribute 'assign' not appropriate for object}}
28
29 @property(nonatomic,copy) int (^includeMailboxCondition)(void);
30 @property(nonatomic,copy) int (*includeMailboxCondition2)(void); // expected-error {{property with 'copy' attribute must be of object type}}
31
32 @end
33
34 @interface I0()
35 @property (retain) int PROP; // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
36 @property (strong) int SPROP; // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
37 @property(nonatomic,copy) int (*PROP1)(void); // expected-error {{property with 'copy' attribute must be of object type}}
38 @property(nonatomic,weak) int (*PROP2)(void); // expected-error {{property with 'weak' attribute must be of object type}}
39 @end
40
41 @interface rdar10357768
42 {
43 int n1;
44 }
45 @property (readonly, setter=crushN1:) int n1; // expected-warning {{setter cannot be specified for a readonly property}}
46 @end
47