blob: 9764d89a4641ae3240e184301a3ed1064a65fdc7 [file] [log] [blame]
/* APPLE LOCAL file radar global blocks */
/* More testing of copied in variables in nested blocks. */
/* { dg-options "-fblocks -mmacosx-version-min=10.6 -ObjC -framework Foundation" { target *-*-darwin* } } */
/* { dg-do run } */
#import <Foundation/Foundation.h>
void *_NSConcreteGlobalBlock;
id Global = nil;
void callVoidVoid(void (^closure)(void)) {
closure();
}
int argc = 1;
id x;
void (^vv)(void) = ^{
if (argc > 0) {
callVoidVoid(^{ Global = x; });
}
};
int main() {
x = [[NSObject alloc] init];
id initial_x = x;
vv();
if (Global != initial_x) {
exit(1);
}
return 0;
}