aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/opt/pr57661.C
blob: 9573663afca2466c752d86da27ec9cce9d2e37c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// PR tree-optimization/57661
// { dg-do compile { target c++11 } }
// { dg-options "-O2 -fno-tree-forwprop" }

template <typename>
struct A
{
  ~A () {}
};
template <typename _Tp>
using B = A <_Tp>;
template <typename _Tp>
class C : B <_Tp> {};
namespace N { enum D { d }; }
template <class>
struct E
{
  ~E ();
};
template <class, class V>
struct F : V {};
template <class U, class V>
struct G : F <U, V>
{
  N::D g1;
  void g2 ();
  void g3 ();
  void g4 () { g3 (); }
  static void g5 (G *__t) { __t->g4 (); }
};
template <class U, class V>
struct H : G <U, V>
{
  E <U> *h1;
  bool h2;
  ~H () throw ()
  {
    this->g2 ();
    if (h2)
      delete h1;
  }
};
template <class U, class V>
struct I : H <U, V>, E <U>
{
  G <U, V> *i;
  ~I () throw ()
  {
    i->g4 ();
  }
};
struct J
{
  typedef C <char> j1;
  typedef G <char, C <char>> j2;
  J ();
  j2 *j3;
};
struct K : J
{
  typedef G <char, C <char>> j2;
  K () { j2::g5 (this->j3); }
};
template <class U, class V>
void G <U, V>::g3 ()
{
  switch (g1)
    {
    case N::d:
      {
	I <U, V> *q = (I <U, V> *) this;
	q->I <U, V>::~I ();
      }
    }
}
K r;