OSDN Git Service

PR c++/34774
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / opt / pr23299.C
1 // PR rtl-optimization/23299
2 // { dg-do run }
3 // { dg-options "-Os" }
4
5 extern "C" void abort ();
6
7 struct A
8 {
9   virtual int a () {}
10 };
11 struct B : public A
12 {
13   virtual int b () {}
14 };
15 struct C : public A
16 {
17   virtual int c () {}
18 };
19 struct D
20 {
21   D () { d = 64; }
22   ~D ();
23   int d;
24 };
25
26 int x;
27 D::~D ()
28 {
29   x |= 1;
30   if (d != 64)
31     abort ();
32 }
33
34 struct E : public B, public C
35 {
36   E () {}
37   virtual int c ();
38   ~E ();
39   D dv;
40 };
41
42 E::~E ()
43 {
44   int r = c ();
45 }
46
47 int
48 E::c ()
49 {
50   if (x > 10)
51     throw 1;
52   x |= 2;
53 }
54
55 int
56 main (void)
57 {
58   {
59     E e;
60   }
61   if (x != 3)
62     abort ();
63 }