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