1 /* Test basic Objective-C foreach syntax. This tests warnings and errors. */
3 { dg-options "-ftrack-macro-expansion=0" }
7 #import "../objc-obj-c++-shared/TestsuiteObject.h"
12 struct __objcFastEnumerationState
16 unsigned long *mutationsPtr;
17 unsigned long extra[5];
20 @interface TestsuiteObject (NSFastEnumeration)
21 - (unsigned long)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state
22 objects:(id *)stackbuf
23 count:(unsigned int)len;
32 id object_function (void)
42 for (typedef int my_typedef in array) /* { dg-error "declaration of non-variable" } */
43 ; /* { dg-error "iterating variable in fast enumeration is not an object" "" { target *-*-* } .-1 } */
45 for (function () in nil) /* { dg-error "invalid iterating variable in fast enumeration" } */
46 ; /* { dg-error "iterating variable in fast enumeration is not an object" "" { target *-*-* } .-1 } */
48 for (object_function () in nil) /* { dg-error "invalid iterating variable in fast enumeration" } */
51 for ([object enumerator] in array) /* { dg-error "invalid iterating variable in fast enumeration" } */
54 for (object = nil in array) /* { dg-error "invalid iterating variable in fast enumeration" } */
57 for (id key, value in array) /* { dg-error "multiple iterating variables in fast enumeration" } */