1 // RUN: %clang_cc1 -fblocks -emit-llvm -o - %s
2
foo(T t)3 template <typename T> T foo(T t)
4 {
5 void (^block)(int);
6 return 1;
7 }
8
test1(void)9 int test1(void)
10 {
11 int i = 1;
12 int b = 2;
13 i = foo(b);
14 return 0;
15 }
16
foo(T t,T1 r)17 template <typename T, typename T1> void foo(T t, T1 r)
18 {
19 T block_arg;
20 __block T1 byref_block_arg;
21
22 T1 (^block)(char, T, T1, double) =
23 ^ T1 (char ch, T arg, T1 arg2, double d1) { byref_block_arg = arg2;
24 return byref_block_arg + block_arg + arg; };
25
26 void (^block2)() = ^{};
27 }
28
test2(void)29 void test2(void)
30 {
31 foo(100, 'a');
32 }
33
34 namespace rdar6182276 {
35 extern "C" {
36 int printf(const char *, ...);
37 }
38
foo(T t)39 template <typename T> T foo(T t)
40 {
41 void (^testing)(int) = ^(int bar) { printf("bar is %d\n", bar); };
42 printf("bar is\n");
43 return 1;
44 }
45
gorf(T t)46 template <typename T> void gorf(T t)
47 {
48 foo(t);
49 }
50
51
test(void)52 void test(void)
53 {
54 gorf(2);
55 }
56 }
57
58
59