aboutsummaryrefslogtreecommitdiff
path: root/test/SemaObjC/ivar-lookup-resolution-builtin.m
blob: dd11b51459d7adeb93919fe68df7605da84f4d2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
// pr5986

@interface Test {
  int index;
}
- (int) index;
+ (int) ClassMethod;
@end

@implementation Test
- (int) index
{
  return index;
}
+ (int) ClassMethod
{
  return index;	// expected-error {{instance variable 'index' accessed in class method}}
}
@end

@interface Test1 {
}
- (int) InstMethod;
+ (int) ClassMethod;
@end

@implementation Test1
- (int) InstMethod
{
  return index;	// expected-warning {{implicitly declaring library function 'index'}}	\
                // expected-note {{please include the header <strings.h> or explicitly provide a declaration for 'index'}} \
                // expected-warning {{incompatible pointer to integer conversion returning}}
}
+ (int) ClassMethod
{
  return index; // expected-warning {{incompatible pointer to integer conversion returning}}
}
@end