comparison gcc/testsuite/g++.dg/warn/Waddress-of-packed-member1.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
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 }