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 // CONFIG rdar://6414583 8*7c3d14c8STreehugger Robot 9*7c3d14c8STreehugger Robot // a smaller case of byrefcopyint 10*7c3d14c8STreehugger Robot 11*7c3d14c8STreehugger Robot #include <Block.h> 12*7c3d14c8STreehugger Robot #include <dispatch/dispatch.h> 13*7c3d14c8STreehugger Robot #include <stdio.h> 14*7c3d14c8STreehugger Robot main(int argc,char * argv[])15*7c3d14c8STreehugger Robotint main(int argc, char *argv[]) { 16*7c3d14c8STreehugger Robot __block int c = 1; 17*7c3d14c8STreehugger Robot 18*7c3d14c8STreehugger Robot //printf("&c = %p - c = %i\n", &c, c); 19*7c3d14c8STreehugger Robot 20*7c3d14c8STreehugger Robot int i; 21*7c3d14c8STreehugger Robot for(i =0; i < 2; i++) { 22*7c3d14c8STreehugger Robot dispatch_block_t block = Block_copy(^{ c = i; }); 23*7c3d14c8STreehugger Robot 24*7c3d14c8STreehugger Robot block(); 25*7c3d14c8STreehugger Robot // printf("%i: &c = %p - c = %i\n", i, &c, c); 26*7c3d14c8STreehugger Robot 27*7c3d14c8STreehugger Robot Block_release(block); 28*7c3d14c8STreehugger Robot } 29*7c3d14c8STreehugger Robot printf("%s: success\n", argv[0]); 30*7c3d14c8STreehugger Robot return 0; 31*7c3d14c8STreehugger Robot } 32