1 // RUN: %clang_cc1 -fblocks -fsyntax-only -verify %s 2 // rdar: // 6182276 3 4 template <typename T, typename T1> void foo(T t, T1 r) 5 { 6 T block_arg; 7 __block T1 byref_block_arg; 8 9 T1 (^block)(T) = ^ T1 (T arg) { 10 byref_block_arg = arg; 11 block_arg = arg; // expected-error {{variable is not assignable (missing __block type specifier)}} 12 return block_arg+arg; }; 13 } 14 15 // rdar://10466373 16 template <typename T, typename T1> void noret(T t, T1 r) 17 { 18 (void) ^{ 19 if (1) 20 return t; 21 else if (2) 22 return r; // expected-error {{return type 'double' must match previous return type 'float' when block literal has unspecified explicit return type}} 23 }; 24 } 25 26 int main(void) 27 { 28 foo(100, 'a'); // expected-note {{in instantiation of function template specialization 'foo<int, char>' requested here}} 29 30 noret((float)0.0, double(0.0)); // expected-note {{in instantiation of function template specialization 'noret<float, double>' requested here}} 31 } 32 33