f4a2713ac8
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
40 lines
868 B
Objective-C
40 lines
868 B
Objective-C
// 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
|
|
|