Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -Wreadonly-setter-attrs -verify %s -fblocks |
Daniel Dunbar | 95e61fb | 2008-09-23 21:53:23 +0000 | [diff] [blame] | 2 | |
| 3 | // Check property attribute consistency. |
| 4 | |
| 5 | @interface I0 |
| 6 | @property(readonly, readwrite) int p0; // expected-error {{property attributes 'readonly' and 'readwrite' are mutually exclusive}} |
| 7 | |
| 8 | @property(retain) int p1; // expected-error {{property with 'retain' attribute must be of object type}} |
| 9 | |
| 10 | @property(copy) int p2; // expected-error {{property with 'copy' attribute must be of object type}} |
| 11 | |
| 12 | @property(assign, copy) id p3_0; // expected-error {{property attributes 'assign' and 'copy' are mutually exclusive}} |
| 13 | @property(assign, retain) id p3_1; // expected-error {{property attributes 'assign' and 'retain' are mutually exclusive}} |
| 14 | @property(copy, retain) id p3_2; // expected-error {{property attributes 'copy' and 'retain' are mutually exclusive}} |
| 15 | @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}} |
| 16 | |
| 17 | @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}} |
Steve Naroff | 2bd0372 | 2008-10-21 18:21:45 +0000 | [diff] [blame] | 18 | |
| 19 | @property(nonatomic,copy) int (^includeMailboxCondition)(); |
| 20 | @property(nonatomic,copy) int (*includeMailboxCondition2)(); // expected-error {{property with 'copy' attribute must be of object type}} |
| 21 | |
Daniel Dunbar | 95e61fb | 2008-09-23 21:53:23 +0000 | [diff] [blame] | 22 | @end |
Fariborz Jahanian | ae415dc | 2010-07-13 22:04:56 +0000 | [diff] [blame] | 23 | |
| 24 | @interface I0() |
| 25 | @property (retain) int PROP; // expected-error {{property with 'retain' attribute must be of object type}} |
| 26 | @property(nonatomic,copy) int (*PROP1)(); // expected-error {{property with 'copy' attribute must be of object type}} |
| 27 | @end |
| 28 | |