blob: dd11b51459d7adeb93919fe68df7605da84f4d2b [file] [log] [blame]
Patrick Beardb2f68202012-04-06 18:12:22 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
Fariborz Jahanian48c2d562010-01-12 23:58:59 +00002// 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{
Jean-Daniel Dupas5faf5d32012-01-27 23:21:02 +000031 return index; // expected-warning {{implicitly declaring library function 'index'}} \
Fariborz Jahanian48c2d562010-01-12 23:58:59 +000032 // 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