OSDN Git Service

Backported from mainline
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / objc-foreach-4.m
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* } } } */
7
8 #include <Foundation/NSString.h>
9 #include <Foundation/NSAutoreleasePool.h>
10 #include <Foundation/NSArray.h>
11
12 // gcc -o foo foo.m -framework Foundation
13
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);
19     }
20     [pool release];
21     return 0;
22 }