blob: b9880f180deacf19de32b3fbfbfbddac40864e8a [file] [log] [blame]
/* APPLE LOCAL file radar 5988451 - nested blocks */
/* This test is to make sure that the inner block uses the value of the
copied-in variable at its point of declaration and not when block is envoked.
*/
/* { dg-do run } */
/* { dg-options "-mmacosx-version-min=10.6 -fblocks" { target *-*-darwin* } } */
extern void abort(void);
void * _NSConcreteStackBlock;
void callVoidVoid(void (^closure)(void)) {
closure();
}
int main(int argc, char *argv[]) {
int local_i_var = 1;
void (^vv)(void) = ^{
if (local_i_var != 1)
abort();
if (argc > 0) {
callVoidVoid(^{ if (local_i_var != 1) abort(); });
}
};
local_i_var = 2;
vv();
return 0;
}