Debian Codegraph @

clang/test/SemaObjC/ivar-lookup-resolution-builtin.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2 // pr5986
3
4 @interface Test {
5 int index;
6 }
7 - (int) index;
8 + (int) ClassMethod;
9 @end
10
11 @implementation Test
12 - (int) index
13 {
14 return index;
15 }
16 + (int) ClassMethod
17 {
18 return index; // expected-error {{instance variable 'index' accessed in class method}}
19 }
20 @end
21
22 @interface Test1 {
23 }
24 - (int) InstMethod;
25 + (int) ClassMethod;
26 @end
27
28 @implementation Test1
29 - (int) InstMethod
30 {
31 return index; // expected-error {{call to undeclared library function 'index'}} \
32 // expected-note {{include the header <strings.h> or explicitly provide a declaration for 'index'}} \
33 // expected-error {{incompatible pointer to integer conversion returning}}
34 }
35 + (int) ClassMethod
36 {
37 return index; // expected-error {{incompatible pointer to integer conversion returning}}
38 }
39 @end
40