2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 // See https://llvm.org/LICENSE.txt for license information.
4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 // CONFIG rdar://6255170
12 #include <Block_private.h>
17 main(int argc
, char *argv
[])
21 void (^b
)(void) = ^{ var
++; /*printf("var is at %p with value %d\n", &var, var);*/ };
23 //printf("before copy...\n");
27 for (i
= 0; i
< 10; i
++) {
28 _b
= Block_copy(b
); // make a new copy each time
31 _b(); // should still update the stack
35 //printf("after...\n");
38 if (var
!= shouldbe
) {
39 printf("Hmm, var is %d but should be %d\n", var
, shouldbe
);
42 printf("%s: Success!!\n", argv
[0]);