Shih-wei Liao | ea28516 | 2010-06-04 12:34:56 -0700 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | @interface A |
| 4 | -(int) x; |
| 5 | @property (readonly) int x; |
| 6 | @property int ok; |
| 7 | @end |
| 8 | |
| 9 | @interface B |
| 10 | -(void) setOk:(int)arg; |
| 11 | -(int) x; |
| 12 | -(int) ok; |
| 13 | @end |
| 14 | |
| 15 | void f0(A *a, B* b) { |
John McCall | e859fbf | 2011-10-25 17:37:35 +0000 | [diff] [blame] | 16 | a.x = 10; // expected-error {{assignment to readonly property}} |
Shih-wei Liao | ea28516 | 2010-06-04 12:34:56 -0700 | [diff] [blame] | 17 | a.ok = 20; |
John McCall | e859fbf | 2011-10-25 17:37:35 +0000 | [diff] [blame] | 18 | b.x = 10; // expected-error {{no setter method 'setX:' for assignment to property}} |
Shih-wei Liao | ea28516 | 2010-06-04 12:34:56 -0700 | [diff] [blame] | 19 | b.ok = 20; |
| 20 | } |
| 21 | |
| 22 | typedef struct { |
| 23 | int i1, i2; |
| 24 | } NSRect; |
| 25 | |
| 26 | NSRect NSMakeRect(); |
| 27 | |
| 28 | @interface NSWindow |
| 29 | { |
| 30 | NSRect _frame; |
| 31 | } |
| 32 | - (NSRect)frame; |
| 33 | @end |
| 34 | |
| 35 | @interface NSWindow (Category) |
| 36 | -(void)methodToMakeClangCrash; |
| 37 | @end |
| 38 | |
| 39 | @implementation NSWindow (Category) |
| 40 | -(void)methodToMakeClangCrash |
| 41 | { |
John McCall | e859fbf | 2011-10-25 17:37:35 +0000 | [diff] [blame] | 42 | self.frame = NSMakeRect(); // expected-error {{no setter method 'setFrame:' for assignment to property}} |
Shih-wei Liao | ea28516 | 2010-06-04 12:34:56 -0700 | [diff] [blame] | 43 | } |
| 44 | @end |