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