Home | History | Annotate | Download | only in SemaObjC
      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) {
     16   a.x = 10;  // expected-error {{assignment to readonly property}}
     17   a.ok = 20;
     18   b.x = 10;  // expected-error {{no setter method 'setX:' for assignment to property}}
     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 {
     42  self.frame =  NSMakeRect(); // expected-error {{no setter method 'setFrame:' for assignment to property}}
     43 }
     44 @end
     45