blob: 3484172844b75bbf8704502e6dd1161f3272a383 [file] [log] [blame]
Shih-wei Liaoea285162010-06-04 12:34:56 -07001// 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
15void f0(A *a, B* b) {
John McCalle859fbf2011-10-25 17:37:35 +000016 a.x = 10; // expected-error {{assignment to readonly property}}
Shih-wei Liaoea285162010-06-04 12:34:56 -070017 a.ok = 20;
John McCalle859fbf2011-10-25 17:37:35 +000018 b.x = 10; // expected-error {{no setter method 'setX:' for assignment to property}}
Shih-wei Liaoea285162010-06-04 12:34:56 -070019 b.ok = 20;
20}
21
22typedef struct {
23 int i1, i2;
24} NSRect;
25
26NSRect 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 McCalle859fbf2011-10-25 17:37:35 +000042 self.frame = NSMakeRect(); // expected-error {{no setter method 'setFrame:' for assignment to property}}
Shih-wei Liaoea285162010-06-04 12:34:56 -070043}
44@end