OSDN Git Service

In gcc/objc/:
[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 compile { target *-*-darwin* } } */
4 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
5
6 #include <objc/objc-api.h>
7 #include <Foundation/Foundation.h>
8
9 #if defined (__NEXT_RUNTIME__) && defined (__LP64__)
10 /* Fudge the class reference until we implement the compiler-side 
11    const strings.  */
12 extern void *_NSConstantStringClassReference;
13 #endif
14
15 // gcc -o foo foo.m -framework Foundation
16
17 int main (int argc, char const* argv[]) {
18     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
19     NSArray * arr = [NSArray arrayWithObjects:@"A", @"B", @"C", nil];
20     for (NSString * foo in arr) { 
21       NSLog(@"foo is %@", foo);
22     }
23     [pool release];
24     return 0;
25 }