xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/property-10.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify %s  -fblocks
2f4a2713aSLionel Sambuc
3f4a2713aSLionel Sambuc// Check property attribute consistency.
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambuc@interface I0
6f4a2713aSLionel Sambuc@property(readonly, readwrite) int p0; // expected-error {{property attributes 'readonly' and 'readwrite' are mutually exclusive}}
7f4a2713aSLionel Sambuc
8f4a2713aSLionel Sambuc@property(retain) int p1; // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
9f4a2713aSLionel Sambuc@property(strong) int s1; // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
10f4a2713aSLionel Sambuc
11f4a2713aSLionel Sambuc@property(copy) int p2; // expected-error {{property with 'copy' attribute must be of object type}}
12f4a2713aSLionel Sambuc
13f4a2713aSLionel Sambuc@property(assign, copy) id p3_0; // expected-error {{property attributes 'assign' and 'copy' are mutually exclusive}}
14f4a2713aSLionel Sambuc@property(assign, retain) id p3_1; // expected-error {{property attributes 'assign' and 'retain' are mutually exclusive}}
15f4a2713aSLionel Sambuc@property(assign, strong) id s3_1; // expected-error {{property attributes 'assign' and 'strong' are mutually exclusive}}
16f4a2713aSLionel Sambuc@property(copy, retain) id p3_2; // expected-error {{property attributes 'copy' and 'retain' are mutually exclusive}}
17f4a2713aSLionel Sambuc@property(copy, strong) id s3_2; // expected-error {{property attributes 'copy' and 'strong' are mutually exclusive}}
18f4a2713aSLionel Sambuc@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}}
19f4a2713aSLionel Sambuc@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}}
20f4a2713aSLionel Sambuc
21f4a2713aSLionel Sambuc@property(unsafe_unretained, copy) id p4_0; // expected-error {{property attributes 'unsafe_unretained' and 'copy' are mutually exclusive}}
22f4a2713aSLionel Sambuc@property(unsafe_unretained, retain) id p4_1; // expected-error {{property attributes 'unsafe_unretained' and 'retain' are mutually exclusive}}
23f4a2713aSLionel Sambuc@property(unsafe_unretained, strong) id s4_1; // expected-error {{property attributes 'unsafe_unretained' and 'strong' are mutually exclusive}}
24f4a2713aSLionel Sambuc@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}}
25f4a2713aSLionel Sambuc@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}}
26f4a2713aSLionel Sambuc
27f4a2713aSLionel Sambuc@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 non-GC object}}
28f4a2713aSLionel Sambuc
29f4a2713aSLionel Sambuc@property(nonatomic,copy) int (^includeMailboxCondition)();
30f4a2713aSLionel Sambuc@property(nonatomic,copy) int (*includeMailboxCondition2)(); // expected-error {{property with 'copy' attribute must be of object type}}
31f4a2713aSLionel Sambuc
32f4a2713aSLionel Sambuc@end
33f4a2713aSLionel Sambuc
34f4a2713aSLionel Sambuc@interface I0()
35f4a2713aSLionel Sambuc@property (retain) int PROP;	// expected-error {{property with 'retain (or strong)' attribute must be of object type}}
36f4a2713aSLionel Sambuc@property (strong) int SPROP;	// expected-error {{property with 'retain (or strong)' attribute must be of object type}}
37f4a2713aSLionel Sambuc@property(nonatomic,copy) int (*PROP1)(); // expected-error {{property with 'copy' attribute must be of object type}}
38f4a2713aSLionel Sambuc@property(nonatomic,weak) int (*PROP2)(); // expected-error {{property with 'weak' attribute must be of object type}}
39f4a2713aSLionel Sambuc@end
40f4a2713aSLionel Sambuc
41f4a2713aSLionel Sambuc// rdar://10357768
42f4a2713aSLionel Sambuc@interface rdar10357768
43f4a2713aSLionel Sambuc{
44f4a2713aSLionel Sambuc    int n1;
45f4a2713aSLionel Sambuc}
46f4a2713aSLionel Sambuc@property (readonly, setter=crushN1:) int n1; // expected-warning {{setter cannot be specified for a readonly property}}
47f4a2713aSLionel Sambuc@end
48f4a2713aSLionel Sambuc
49