1 // 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 5 6 #include <Block.h> 7 #include <stdio.h> 8 9 // CONFIG rdar://6225809 10 // fixed in 5623 11 main(int argc,char * argv[])12int main(int argc, char *argv[]) { 13 __block int a = 42; 14 int* ap = &a; // just to keep the address on the stack. 15 16 void (^b)(void) = ^{ 17 //a; // workaround, a should be implicitly imported 18 Block_copy(^{ 19 a = 2; 20 }); 21 }; 22 23 Block_copy(b); 24 25 if(&a == ap) { 26 printf("**** __block heap storage should have been created at this point\n"); 27 return 1; 28 } 29 printf("%s: Success\n", argv[0]); 30 return 0; 31 } 32