1 | // RUN: %clang_cc1 -fsyntax-only -Weverything -verify %s |
2 | // expected-no-diagnostics |
3 | // rdar://11656982 |
4 | /** A property may not be both 'readonly' and having a memory management attribute |
5 | (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 |
7 | extensions. So, do not issue any warning on 'readonly' and memory management |
8 | attributes in a property. |
9 | */ |
10 | |
11 | @interface Super { |
12 | } |
13 | @end |
14 | |
15 | @class NSString; |
16 | |
17 | @interface MyClass : Super |
18 | @property(nonatomic, copy, readonly) NSString *prop; |
19 | @property(nonatomic, copy, readonly) id warnProp; |
20 | @end |
21 | |
22 | @interface MyClass () |
23 | @property(nonatomic, copy, readwrite) NSString *prop; |
24 | @end |
25 | |
26 | @implementation MyClass |
27 | @synthesize prop; |
28 | @synthesize warnProp; |
29 | @end |
30 | |
31 | |
32 | @protocol P |
33 | @property(nonatomic, copy, readonly) NSString *prop; |
34 | @property(nonatomic, copy, readonly) id warnProp; |
35 | @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; |
46 | @synthesize warnProp; |
47 | @end |
48 | |
49 | |