blob: a9649b644c3101a84c49472ab2af21d667063f75 [file] [log] [blame]
Fariborz Jahanian876cc652012-06-20 22:57:42 +00001// RUN: %clang_cc1 -fsyntax-only -Weverything -verify %s
Fariborz Jahanian059021a2013-12-13 18:19:59 +00002// expected-no-diagnostics
Fariborz Jahanian876cc652012-06-20 22:57:42 +00003// rdar://11656982
Fariborz Jahanian059021a2013-12-13 18:19:59 +00004/** A property may not be both 'readonly' and having a memory management attribute
Fariborz Jahanian876cc652012-06-20 22:57:42 +00005 (copy/retain/etc.). But, property declaration in primary class and protcols
6 are tentative as they may be overridden into a 'readwrite' property in class
Fariborz Jahanian059021a2013-12-13 18:19:59 +00007 extensions. So, do not issue any warning on 'readonly' and memory management
8 attributes in a property.
Fariborz Jahanian876cc652012-06-20 22:57:42 +00009*/
10
11@interface Super {
12}
13@end
14
15@class NSString;
16
17@interface MyClass : Super
Fariborz Jahanian059021a2013-12-13 18:19:59 +000018@property(nonatomic, copy, readonly) NSString *prop;
19@property(nonatomic, copy, readonly) id warnProp;
Fariborz Jahanian876cc652012-06-20 22:57:42 +000020@end
21
22@interface MyClass ()
23@property(nonatomic, copy, readwrite) NSString *prop;
24@end
25
26@implementation MyClass
27@synthesize prop;
Fariborz Jahanian914faaf2012-06-20 23:18:57 +000028@synthesize warnProp;
Fariborz Jahanian876cc652012-06-20 22:57:42 +000029@end
30
31
32@protocol P
Fariborz Jahanian059021a2013-12-13 18:19:59 +000033@property(nonatomic, copy, readonly) NSString *prop;
34@property(nonatomic, copy, readonly) id warnProp;
Fariborz Jahanian876cc652012-06-20 22:57:42 +000035@end
36
37@interface YourClass : Super <P>
38@end
39
40@interface YourClass ()
41@property(nonatomic, copy, readwrite) NSString *prop;
42@end
43
44@implementation YourClass
45@synthesize prop;
Fariborz Jahanian914faaf2012-06-20 23:18:57 +000046@synthesize warnProp;
Fariborz Jahanian876cc652012-06-20 22:57:42 +000047@end
48