Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1  -fsyntax-only -verify %s
      2 // rdar://8155806
      3 
      4 @interface Subclass 
      5 {
      6     int setterOnly;
      7 }
      8 - (void) setSetterOnly : (int) arg;
      9 @end
     10 
     11 int func (int arg, Subclass *x) {
     12     if (x.setterOnly) { // expected-error {{no getter method for read from property}}
     13       x.setterOnly = 1;
     14     }
     15     func(x.setterOnly + 1, x); // expected-error {{no getter method for read from property}}
     16     int i = x.setterOnly + 1;  // expected-error {{no getter method for read from property}}
     17     return x.setterOnly + 1;   // expected-error {{no getter method for read from property}}
     18 }
     19 
     20 // <rdar://problem/12765391>
     21 
     22 @interface TestClass 
     23 + (void) setSetterOnly : (int) arg;
     24 @end
     25 
     26 int func2 (int arg) {
     27     if (TestClass.setterOnly) { // expected-error {{no getter method for read from property}}
     28       TestClass.setterOnly = 1;
     29     }
     30     func(TestClass.setterOnly + 1, x); // expected-error {{no getter method for read from property}}
     31     int i = TestClass.setterOnly + 1;  // expected-error {{no getter method for read from property}}
     32     return TestClass.setterOnly + 1;   // expected-error {{no getter method for read from property}}
     33 }
     34 
     35 @interface Sub : Subclass
     36 - (int) func3;
     37 @end
     38 @implementation Sub
     39 - (int) func3 {
     40 	return super.setterOnly; // expected-error {{no getter method for read from property}}
     41 }
     42 @end
     43