1*7c3d14c8STreehugger Robot // 2*7c3d14c8STreehugger Robot // The LLVM Compiler Infrastructure 3*7c3d14c8STreehugger Robot // 4*7c3d14c8STreehugger Robot // This file is distributed under the University of Illinois Open Source 5*7c3d14c8STreehugger Robot // License. See LICENSE.TXT for details. 6*7c3d14c8STreehugger Robot 7*7c3d14c8STreehugger Robot #include <Block.h> 8*7c3d14c8STreehugger Robot #include <stdio.h> 9*7c3d14c8STreehugger Robot 10*7c3d14c8STreehugger Robot // CONFIG rdar://6225809 11*7c3d14c8STreehugger Robot // fixed in 5623 12*7c3d14c8STreehugger Robot main(int argc,char * argv[])13*7c3d14c8STreehugger Robotint main(int argc, char *argv[]) { 14*7c3d14c8STreehugger Robot __block int a = 42; 15*7c3d14c8STreehugger Robot int* ap = &a; // just to keep the address on the stack. 16*7c3d14c8STreehugger Robot 17*7c3d14c8STreehugger Robot void (^b)(void) = ^{ 18*7c3d14c8STreehugger Robot //a; // workaround, a should be implicitly imported 19*7c3d14c8STreehugger Robot Block_copy(^{ 20*7c3d14c8STreehugger Robot a = 2; 21*7c3d14c8STreehugger Robot }); 22*7c3d14c8STreehugger Robot }; 23*7c3d14c8STreehugger Robot 24*7c3d14c8STreehugger Robot Block_copy(b); 25*7c3d14c8STreehugger Robot 26*7c3d14c8STreehugger Robot if(&a == ap) { 27*7c3d14c8STreehugger Robot printf("**** __block heap storage should have been created at this point\n"); 28*7c3d14c8STreehugger Robot return 1; 29*7c3d14c8STreehugger Robot } 30*7c3d14c8STreehugger Robot printf("%s: Success\n", argv[0]); 31*7c3d14c8STreehugger Robot return 0; 32*7c3d14c8STreehugger Robot } 33