brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 406e267 Raw
41 lines · plain
1// RUN: %clang_cc1  -fsyntax-only -verify %s2 3@interface Subclass 4{5    int setterOnly;6}7- (void) setSetterOnly : (int) arg;8@end9 10int func (int arg, Subclass *x) {11    if (x.setterOnly) { // expected-error {{no getter method for read from property}}12      x.setterOnly = 1;13    }14    func(x.setterOnly + 1, x); // expected-error {{no getter method for read from property}}15    int i = x.setterOnly + 1;  // expected-error {{no getter method for read from property}}16    return x.setterOnly + 1;   // expected-error {{no getter method for read from property}}17}18 19@interface TestClass 20+ (void) setSetterOnly : (int) arg;21@end22 23int func2 (int arg) {24    if (TestClass.setterOnly) { // expected-error {{no getter method for read from property}}25      TestClass.setterOnly = 1;26    }27    func(TestClass.setterOnly + 1, x); // expected-error {{no getter method for read from property}} \28                                       // expected-error {{use of undeclared identifier 'x'}}29    int i = TestClass.setterOnly + 1;  // expected-error {{no getter method for read from property}}30    return TestClass.setterOnly + 1;   // expected-error {{no getter method for read from property}}31}32 33@interface Sub : Subclass34- (int) func3;35@end36@implementation Sub37- (int) func3 {38	return super.setterOnly; // expected-error {{no getter method for read from property}}39}40@end41