xref: /minix3/external/bsd/llvm/dist/clang/test/Parser/objc-forcollection-neg.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambucstruct __objcFastEnumerationState;
4*f4a2713aSLionel Sambuctypedef struct objc_class *Class;
5*f4a2713aSLionel Sambuctypedef struct objc_object {
6*f4a2713aSLionel Sambuc Class isa;
7*f4a2713aSLionel Sambuc} *id;
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc@interface MyList
11*f4a2713aSLionel Sambuc@end
12*f4a2713aSLionel Sambuc
13*f4a2713aSLionel Sambuc@implementation MyList
14*f4a2713aSLionel Sambuc- (unsigned int)countByEnumeratingWithState:  (struct __objcFastEnumerationState *)state objects:  (id *)items count:(unsigned int)stackcount
15*f4a2713aSLionel Sambuc{
16*f4a2713aSLionel Sambuc        return 0;
17*f4a2713aSLionel Sambuc}
18*f4a2713aSLionel Sambuc@end
19*f4a2713aSLionel Sambuc
20*f4a2713aSLionel Sambuc@interface MyList (BasicTest)
21*f4a2713aSLionel Sambuc- (void)compilerTestAgainst;
22*f4a2713aSLionel Sambuc@end
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc@implementation MyList (BasicTest)
25*f4a2713aSLionel Sambuc- (void)compilerTestAgainst {
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambuc        int i=0;
28*f4a2713aSLionel Sambuc        for (int * elem in elem) // expected-error {{selector element type 'int *' is not a valid object}} \
29*f4a2713aSLionel Sambuc				    expected-error {{the type 'int *' is not a pointer to a fast-enumerable object}}
30*f4a2713aSLionel Sambuc           ++i;
31*f4a2713aSLionel Sambuc        for (i in elem)  // expected-error {{use of undeclared identifier 'elem'}} \
32*f4a2713aSLionel Sambuc			    expected-error {{selector element type 'int' is not a valid object}}
33*f4a2713aSLionel Sambuc           ++i;
34*f4a2713aSLionel Sambuc        for (id se in i) // expected-error {{the type 'int' is not a pointer to a fast-enumerable object}}
35*f4a2713aSLionel Sambuc           ++i;
36*f4a2713aSLionel Sambuc}
37*f4a2713aSLionel Sambuc@end
38*f4a2713aSLionel Sambuc
39