Fariborz Jahanian | cea06d2 | 2012-06-20 22:57:42 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -Weverything -verify %s |
| 2 | // rdar://11656982 |
| 3 | /** Normally, a property cannot be both 'readonly' and having a "write" attribute |
| 4 | (copy/retain/etc.). But, property declaration in primary class and protcols |
| 5 | are tentative as they may be overridden into a 'readwrite' property in class |
| 6 | extensions. Postpone diagnosing such warnings until the class implementation |
| 7 | is seen. |
| 8 | */ |
| 9 | |
| 10 | @interface Super { |
| 11 | } |
| 12 | @end |
| 13 | |
| 14 | @class NSString; |
| 15 | |
| 16 | @interface MyClass : Super |
| 17 | @property(nonatomic, copy, readonly) NSString *prop; |
| 18 | @end |
| 19 | |
| 20 | @interface MyClass () |
| 21 | @property(nonatomic, copy, readwrite) NSString *prop; |
| 22 | @end |
| 23 | |
| 24 | @implementation MyClass |
| 25 | @synthesize prop; |
| 26 | @end |
| 27 | |
| 28 | |
| 29 | @protocol P |
| 30 | @property(nonatomic, copy, readonly) NSString *prop; |
| 31 | @end |
| 32 | |
| 33 | @interface YourClass : Super <P> |
| 34 | @end |
| 35 | |
| 36 | @interface YourClass () |
| 37 | @property(nonatomic, copy, readwrite) NSString *prop; |
| 38 | @end |
| 39 | |
| 40 | @implementation YourClass |
| 41 | @synthesize prop; |
| 42 | @end |
| 43 | |