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