blob: 9b24e6323d4547fecb0b20ca4ed25a82fea84865 [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -rewrite-blocks %s -fblocks -o -
Steve Naroffeab5f632008-09-23 19:24:41 +00002
Steve Naroffca743602008-10-15 18:38:58 +00003static int (^block)(const void *, const void *) = (int (^)(const void *, const void *))0;
4static int (*func)(int (^block)(void *, void *)) = (int (*)(int (^block)(void *, void *)))0;
5
6typedef int (^block_T)(const void *, const void *);
7typedef int (*func_T)(int (^block)(void *, void *));
8
9void foo(const void *a, const void *b, void *c) {
10 int (^block)(const void *, const void *) = (int (^)(const void *, const void *))c;
11 int (*func)(int (^block)(void *, void *)) = (int (*)(int (^block)(void *, void *)))c;
12}
13
Steve Naroffeab5f632008-09-23 19:24:41 +000014typedef void (^test_block_t)();
15
16int main(int argc, char **argv) {
17 int a;
18
19 void (^test_block_v)();
20 void (^test_block_v2)(int, float);
21
22 void (^test_block_v3)(void (^barg)(int));
23
24 a = 77;
25 test_block_v = ^(){ int local=1; printf("a=%d\n",a+local); };
26 test_block_v();
27 a++;
28 test_block_v();
29
30 __block int b;
31
32 b = 88;
33 test_block_v2 = ^(int x, float f){ printf("b=%d\n",b); };
34 test_block_v2(1,2.0);
35 b++;
36 test_block_v2(3,4.0);
37 return 7;
38}