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