Debian Codegraph @

gcc/testsuite/objc.dg/objc-foreach-3.m

raw
1 /* Syntax check for the new foreach statement.
2 Use of declaration in loop-header without requiring c99 mode. */
3 /* { dg-do compile } */
4 /* { dg-additional-options "-Wno-objc-root-class" } */
5
6 typedef struct objc_class *Class;
7
8 typedef struct objc_object {
9 Class isa;
10 } *id;
11
12
13 @interface MyList
14 @end
15
16 @implementation MyList
17 - (unsigned int)countByEnumeratingWithState:(struct __objcFastEnumerationState *)state objects:(id *)items count:(unsigned int)stackcount
18 {
19 return 0;
20 }
21 - (void)addObject:object {
22 }
23
24 @end
25
26 @interface MyList (BasicTest)
27 - (void)compilerTestAgainst;
28 @end
29 void BEGIN();
30 void INFORLOOP();
31 void END();
32 @implementation MyList (BasicTest)
33 - (void)compilerTestAgainst {
34
35 BEGIN();
36 for (id elem in (self))
37 if (elem)
38 INFORLOOP();
39
40 END();
41 }
42 @end
43