1 /* Test for valid objc objects used in a for-each statement. */
2 /* FIXME: Run this test with the GNU runtime as well. */
3 /* { dg-do run { target *-*-darwin* } } */
4 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
5 /* { dg-skip-if "No NeXT fast enum. pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
6 /* { dg-additional-options "-framework Foundation" { target { *-*-darwin* } } } */
8 #include <Foundation/NSString.h>
9 #include <Foundation/NSAutoreleasePool.h>
10 #include <Foundation/NSArray.h>
12 // gcc -o foo foo.m -framework Foundation
14 int main (int argc, char const* argv[]) {
15 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
16 NSArray * arr = [NSArray arrayWithObjects:@"A", @"B", @"C", nil];
17 for (NSString * foo in arr) {
18 NSLog(@"foo is %@", foo);