Keep the source location of the selector in ObjCMessageExpr.
[clang.git] / test / SemaObjC / property-error-readonly-assign.m
blobfc8c48c4f6cf2fde44c6899249439788ff7dd9b9
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 @interface A
4  -(int) x;
5 @property (readonly) int x;
6 @property int ok;
7 @end
9 @interface B
10  -(void) setOk:(int)arg;
11  -(int) x;
12  -(int) ok;
13 @end
15 void f0(A *a, B* b) {
16   a.x = 10;  // expected-error {{assigning to property with 'readonly' attribute not allowed}}
17   a.ok = 20;
18   b.x = 10;  // expected-error {{setter method is needed to assign to object using property assignment syntax}}
19   b.ok = 20;
22 typedef struct {
23   int i1, i2;
24 } NSRect;
26 NSRect NSMakeRect();
28 @interface NSWindow 
30     NSRect _frame;
32 - (NSRect)frame;
33 @end
35 @interface NSWindow (Category)
36 -(void)methodToMakeClangCrash;
37 @end
39 @implementation NSWindow (Category)
40 -(void)methodToMakeClangCrash
42  self.frame =  NSMakeRect(); // expected-error {{setter method is needed to assign to object using property assignment syntax}}
44 @end