xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/tentative-property-decl.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -Weverything -verify %s
2*0a6a1f1dSLionel Sambuc// expected-no-diagnostics
3f4a2713aSLionel Sambuc// rdar://11656982
4*0a6a1f1dSLionel Sambuc/** A property may not be both 'readonly' and having a memory management attribute
5f4a2713aSLionel Sambuc    (copy/retain/etc.). But, property declaration in primary class and protcols
6f4a2713aSLionel Sambuc    are tentative as they may be overridden into a 'readwrite' property in class
7*0a6a1f1dSLionel Sambuc    extensions. So, do not issue any warning on 'readonly' and memory management
8*0a6a1f1dSLionel Sambuc    attributes in a property.
9f4a2713aSLionel Sambuc*/
10f4a2713aSLionel Sambuc
11f4a2713aSLionel Sambuc@interface Super {
12f4a2713aSLionel Sambuc}
13f4a2713aSLionel Sambuc@end
14f4a2713aSLionel Sambuc
15f4a2713aSLionel Sambuc@class NSString;
16f4a2713aSLionel Sambuc
17f4a2713aSLionel Sambuc@interface MyClass : Super
18*0a6a1f1dSLionel Sambuc@property(nonatomic, copy, readonly) NSString *prop;
19*0a6a1f1dSLionel Sambuc@property(nonatomic, copy, readonly) id warnProp;
20f4a2713aSLionel Sambuc@end
21f4a2713aSLionel Sambuc
22f4a2713aSLionel Sambuc@interface MyClass ()
23f4a2713aSLionel Sambuc@property(nonatomic, copy, readwrite) NSString *prop;
24f4a2713aSLionel Sambuc@end
25f4a2713aSLionel Sambuc
26f4a2713aSLionel Sambuc@implementation MyClass
27f4a2713aSLionel Sambuc@synthesize prop;
28f4a2713aSLionel Sambuc@synthesize warnProp;
29f4a2713aSLionel Sambuc@end
30f4a2713aSLionel Sambuc
31f4a2713aSLionel Sambuc
32f4a2713aSLionel Sambuc@protocol P
33*0a6a1f1dSLionel Sambuc@property(nonatomic, copy, readonly) NSString *prop;
34*0a6a1f1dSLionel Sambuc@property(nonatomic, copy, readonly) id warnProp;
35f4a2713aSLionel Sambuc@end
36f4a2713aSLionel Sambuc
37f4a2713aSLionel Sambuc@interface YourClass : Super <P>
38f4a2713aSLionel Sambuc@end
39f4a2713aSLionel Sambuc
40f4a2713aSLionel Sambuc@interface YourClass ()
41f4a2713aSLionel Sambuc@property(nonatomic, copy, readwrite) NSString *prop;
42f4a2713aSLionel Sambuc@end
43f4a2713aSLionel Sambuc
44f4a2713aSLionel Sambuc@implementation YourClass
45f4a2713aSLionel Sambuc@synthesize prop;
46f4a2713aSLionel Sambuc@synthesize warnProp;
47f4a2713aSLionel Sambuc@end
48f4a2713aSLionel Sambuc
49