Debian Codegraph @

gcc/testsuite/g++.dg/opt/pr57661.C

raw
1 // PR tree-optimization/57661
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-O2 -fno-tree-forwprop" }
4
5 template <typename>
6 struct A
7 {
8 ~A () {}
9 };
10 template <typename _Tp>
11 using B = A <_Tp>;
12 template <typename _Tp>
13 class C : B <_Tp> {};
14 namespace N { enum D { d }; }
15 template <class>
16 struct E
17 {
18 ~E ();
19 };
20 template <class, class V>
21 struct F : V {};
22 template <class U, class V>
23 struct G : F <U, V>
24 {
25 N::D g1;
26 void g2 ();
27 void g3 ();
28 void g4 () { g3 (); }
29 static void g5 (G *__t) { __t->g4 (); }
30 };
31 template <class U, class V>
32 struct H : G <U, V>
33 {
34 E <U> *h1;
35 bool h2;
36 ~H () throw ()
37 {
38 this->g2 ();
39 if (h2)
40 delete h1;
41 }
42 };
43 template <class U, class V>
44 struct I : H <U, V>, E <U>
45 {
46 G <U, V> *i;
47 ~I () throw ()
48 {
49 i->g4 ();
50 }
51 };
52 struct J
53 {
54 typedef C <char> j1;
55 typedef G <char, C <char>> j2;
56 J ();
57 j2 *j3;
58 };
59 struct K : J
60 {
61 typedef G <char, C <char>> j2;
62 K () { j2::g5 (this->j3); }
63 };
64 template <class U, class V>
65 void G <U, V>::g3 ()
66 {
67 switch (g1)
68 {
69 case N::d:
70 {
71 I <U, V> *q = (I <U, V> *) this;
72 q->I <U, V>::~I ();
73 }
74 }
75 }
76 K r;