1 // PR c++/51878
2 // { dg-do compile { target c++11 } }
3
4 template<class F, class... T>
5 auto indirect_call(F f, T... t) -> decltype(f(t...))
6 {
7 return f(t...);
8 }
9
10 template<class F, class T>
11 struct VariadicBind
12 {
13 F f;
14 T t;
15
16 template<class... A>
17 auto operator()(A... a) -> decltype(indirect_call(f, t, a...))
18 {
19 return indirect_call(f, t, a...);
20 }
21 };
22
23 template<class F>
apply(F f)24 void apply(F f)
25 {
26 f();
27 }
28
29 template<class F, class V1, class... V>
apply(F f,V1 v1,V...v)30 void apply(F f, V1 v1, V... v)
31 {
32 apply(VariadicBind<F, int>{f, v1}, v...);
33 }
34
func(int,int)35 void func(int, int) { }
36
main()37 int main()
38 {
39 apply(func, 0, 0);
40 }
41