1 // RUN: %clang_cc1 -std=c++11 -fblocks -fsyntax-only -verify %s
2
3 // Tests the use of blocks with variadic templates.
4 template<typename ...Args>
f0(Args...args)5 int f0(Args ...args) {
6 return ^ {
7 return sizeof...(Args);
8 }() + ^ {
9 return sizeof...(args);
10 }();
11 }
12
13 template<typename ...Args>
f1(Args...args)14 int f1(Args ...args) {
15 return ^ {
16 return f0(args...);
17 }();
18 }
19
20 template int f0(int, float, double);
21 template int f1(const char*, int, float, double);
22
23 template<typename ...Args>
f2(Args...args)24 int f2(Args ...args) {
25 return ^(Args ...block_args) {
26 return f1(block_args...);
27 }(args + 0 ...);
28 }
29
30 template int f2(const char*, int, float, double);
31
32 template<typename ...Args>
f3(Args...args)33 int f3(Args ...args) {
34 return ^(Args *...block_args) {
35 return f1(block_args...);
36 }(&args...);
37 }
38
39 template int f3(const char*, int, float, double);
40
41 template<typename ...Args>
PR9953(Args...args)42 int PR9953(Args ...args) {
43 return ^(Args *...block_args) {
44 return f1(block_args); // expected-error{{expression contains unexpanded parameter pack 'block_args'}}
45 }(&args...);
46 }
47