1 /* Test basic Objective-C foreach syntax. This tests warnings and errors. */
2 /* { dg-do compile } */
4 #import "../objc-obj-c++-shared/Object1.h"
5 #import "../objc-obj-c++-shared/next-mapping.h"
8 struct __objcFastEnumerationState
12 unsigned long *mutationsPtr;
13 unsigned long extra[5];
16 @interface Object (NSFastEnumeration)
17 - (unsigned long)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state
18 objects:(id *)stackbuf
19 count:(unsigned int)len;
28 id object_function (void)
38 for (typedef int my_typedef in array) /* { dg-error "declaration of non-variable" } */
39 ; /* { dg-error "iterating variable in fast enumeration is not an object" } */
41 for (function () in nil) /* { dg-error "invalid iterating variable in fast enumeration" } */
42 ; /* { dg-error "iterating variable in fast enumeration is not an object" } */
44 for (object_function () in nil) /* { dg-error "invalid iterating variable in fast enumeration" } */
47 for ([object enumerator] in array) /* { dg-error "invalid iterating variable in fast enumeration" } */
50 for (object = nil in array) /* { dg-error "invalid iterating variable in fast enumeration" } */
53 for (id key, value in array) /* { dg-error "multiple iterating variables in fast enumeration" } */