blob: 2e90e8e044257be79392a0464f26383d7aed1651 [file] [log] [blame]
Fariborz Jahanian48c2d562010-01-12 23:58:59 +00001// RUN: %clang_cc1 -fsyntax-only -verify %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-warning {{implicitly declaring C library function 'index'}} \
32 // expected-note {{please include the header <strings.h> or explicitly provide a declaration for 'index'}} \
33 // expected-warning {{incompatible pointer to integer conversion returning}}
34}
35+ (int) ClassMethod
36{
37 return index; // expected-warning {{incompatible pointer to integer conversion returning}}
38}
39@end
40