Debian Codegraph @

clang/test/SemaObjC/error-missing-getter.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
3 @interface Subclass
4 {
5 int setterOnly;
6 }
7 - (void) setSetterOnly : (int) arg;
8 @end
9
10 int 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 @end
22
23 int 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 : Subclass
34 - (int) func3;
35 @end
36 @implementation Sub
37 - (int) func3 {
38 return super.setterOnly; // expected-error {{no getter method for read from property}}
39 }
40 @end