OSDN Git Service

In gcc/objc/:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / objc-foreach-2.m
1 /* Syntax check for the new foreach statement. */
2 /* { dg-do compile } */
3
4 typedef struct objc_class *Class;
5
6 typedef struct objc_object {
7  Class isa;
8 } *id;
9
10
11 @interface MyList 
12 @end
13
14 @implementation MyList
15 - (unsigned int)countByEnumeratingWithState:(struct __objcFastEnumerationState *)state objects:(id *)items count:(unsigned int)stackcount
16 {
17         return 0;
18 }
19 - (void)addObject:object {
20 }
21
22 @end
23
24 @interface MyList (BasicTest)
25 - (void)compilerTestAgainst;
26 @end
27 void BEGIN();
28 void INFORLOOP();
29 void END();
30 @implementation MyList (BasicTest)
31 - (void)compilerTestAgainst {
32
33         id elem;
34         BEGIN();
35         for (elem in (self)) 
36           if (elem)
37             INFORLOOP();
38         END();
39 }
40 @end
41