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