2012-04-07 02:12:22 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
|
2010-01-13 07:58:59 +08:00
|
|
|
// 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
|
|
|
|
{
|
2012-01-28 07:21:02 +08:00
|
|
|
return index; // expected-warning {{implicitly declaring library function 'index'}} \
|
2010-01-13 07:58:59 +08:00
|
|
|
// 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
|
|
|
|
|