Debian Codegraph @

gcc/testsuite/g++.dg/ipa/pr106260.C

raw
1 // { dg-do compile }
2 // { dg-options "-O2 -std=gnu++14 -fwhole-program -fno-unit-at-a-time" }
3
4 struct A;
5 template <class T>
6 struct Q { Q (T); };
7 template<typename T, class D>
8 struct U {
9 ~U () { m1 (nullptr); }
10 D m2 ();
11 T *u;
12 void m1 (T *) { m2 () (u); }
13 };
14 struct F { F (int *); };
15 template <class, class T = F>
16 using W = Q<T>;
17 int a, b;
18 void fn1 (void *);
19 template <class T>
20 void
21 fn2 (T *x)
22 {
23 if (x)
24 x->~T();
25 fn1 (x);
26 }
27 template <typename T>
28 struct C {
29 void operator() (T *x) { fn2 (x); }
30 };
31 struct D;
32 template <typename T, typename D = C<T> >
33 using V = U<T, D>;
34 struct A {
35 A (int *);
36 };
37 struct S;
38 struct G {
39 V<S> m3 ();
40 };
41 struct S {
42 int e;
43 virtual ~S () {}
44 };
45 template<typename T>
46 struct H {
47 H (int, T x, int) : h(x) {}
48 G g;
49 void m4 () { g.m3 (); }
50 T h;
51 };
52 struct I {
53 I(A, W<D>);
54 };
55 void
56 test ()
57 {
58 A c (&b);
59 W<D> d (&b);
60 I e (c, d);
61 H<I> f (0, e, a);
62 f.m4 ();
63 }
64