Fix all tests that fail with -sanitize=return.
[official-gcc.git] / gcc / testsuite / g++.dg / opt / pr23299.C
blobb791bf954e891493f4f347e9a8d36a23735d5d0c
1 // PR rtl-optimization/23299
2 // { dg-do run }
3 // { dg-options "-Os" }
5 extern "C" void abort ();
7 struct A
9   virtual int a () {}
11 struct B : public A
13   virtual int b () {}
15 struct C : public A
17   virtual int c () {}
19 struct D
21   D () { d = 64; }
22   ~D ();
23   int d;
26 int x;
27 D::~D ()
29   x |= 1;
30   if (d != 64)
31     abort ();
34 struct E : public B, public C
36   E () {}
37   virtual int c ();
38   ~E ();
39   D dv;
42 E::~E ()
44   int r = c ();
47 int
48 E::c ()
50   if (x > 10)
51     throw 1;
52   x |= 2;
54   return x;
57 int
58 main (void)
60   {
61     E e;
62   }
63   if (x != 3)
64     abort ();