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