xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/ivar-lookup-resolution-builtin.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
2f4a2713aSLionel Sambuc// pr5986
3f4a2713aSLionel Sambuc
4f4a2713aSLionel Sambuc@interface Test {
5f4a2713aSLionel Sambuc  int index;
6f4a2713aSLionel Sambuc}
7f4a2713aSLionel Sambuc- (int) index;
8f4a2713aSLionel Sambuc+ (int) ClassMethod;
9f4a2713aSLionel Sambuc@end
10f4a2713aSLionel Sambuc
11f4a2713aSLionel Sambuc@implementation Test
12f4a2713aSLionel Sambuc- (int) index
13f4a2713aSLionel Sambuc{
14f4a2713aSLionel Sambuc  return index;
15f4a2713aSLionel Sambuc}
16f4a2713aSLionel Sambuc+ (int) ClassMethod
17f4a2713aSLionel Sambuc{
18f4a2713aSLionel Sambuc  return index;	// expected-error {{instance variable 'index' accessed in class method}}
19f4a2713aSLionel Sambuc}
20f4a2713aSLionel Sambuc@end
21f4a2713aSLionel Sambuc
22f4a2713aSLionel Sambuc@interface Test1 {
23f4a2713aSLionel Sambuc}
24f4a2713aSLionel Sambuc- (int) InstMethod;
25f4a2713aSLionel Sambuc+ (int) ClassMethod;
26f4a2713aSLionel Sambuc@end
27f4a2713aSLionel Sambuc
28f4a2713aSLionel Sambuc@implementation Test1
29f4a2713aSLionel Sambuc- (int) InstMethod
30f4a2713aSLionel Sambuc{
31f4a2713aSLionel Sambuc  return index;	// expected-warning {{implicitly declaring library function 'index'}}	\
32*0a6a1f1dSLionel Sambuc                // expected-note {{include the header <strings.h> or explicitly provide a declaration for 'index'}} \
33f4a2713aSLionel Sambuc                // expected-warning {{incompatible pointer to integer conversion returning}}
34f4a2713aSLionel Sambuc}
35f4a2713aSLionel Sambuc+ (int) ClassMethod
36f4a2713aSLionel Sambuc{
37f4a2713aSLionel Sambuc  return index; // expected-warning {{incompatible pointer to integer conversion returning}}
38f4a2713aSLionel Sambuc}
39f4a2713aSLionel Sambuc@end
40f4a2713aSLionel Sambuc
41