]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
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 | // | |
8 | // byrefcopystack.m | |
9 | // testObjects | |
10 | // | |
11 | // Created by Blaine Garst on 5/13/08. | |
12 | // | |
13 | ||
14 | ||
15 | ||
16 | #include <stdio.h> | |
17 | #include <Block.h> | |
18 | ||
19 | // CONFIG rdar://6255170 | |
20 | ||
21 | void (^bumpi)(void); | |
22 | int (^geti)(void); | |
23 | ||
24 | void setClosures() { | |
25 | int __block i = 10; | |
26 | bumpi = Block_copy(^{ ++i; }); | |
27 | geti = Block_copy(^{ return i; }); | |
28 | } | |
29 | ||
30 | int main(int argc, char *argv[]) { | |
31 | setClosures(); | |
32 | bumpi(); | |
33 | int i = geti(); | |
34 | ||
35 | if (i != 11) { | |
36 | printf("*** %s didn't update i\n", argv[0]); | |
37 | return 1; | |
38 | } | |
39 | printf("%s: success\n", argv[0]); | |
40 | return 0; | |
41 | } |