| 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 "../objc-obj-c++-shared/F-NSString.h" |
| 9 |
#include "../objc-obj-c++-shared/F-NSAutoreleasePool.h" |
| 10 |
#include "../objc-obj-c++-shared/F-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 |
} |