1/* 2 * Copyright (c) 2010 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LLVM_LICENSE_HEADER@ 5 */ 6 7// TEST_CONFIG 8 9#include <Block.h> 10#include <stdio.h> 11#include "test.h" 12 13// rdar://6225809 14// fixed in 5623 15 16int main() { 17 __block int a = 42; 18 int* ap = &a; // just to keep the address on the stack. 19 20 void (^b)(void) = ^{ 21 //a; // workaround, a should be implicitly imported 22 (void)Block_copy(^{ 23 a = 2; 24 }); 25 }; 26 27 (void)Block_copy(b); 28 29 if(&a == ap) { 30 fail("__block heap storage should have been created at this point"); 31 } 32 33 succeed(__FILE__); 34} 35