| 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 () { return 0; } |
| 10 |
}; |
| 11 |
struct B : public A |
| 12 |
{ |
| 13 |
virtual int b () { return 1; } |
| 14 |
}; |
| 15 |
struct C : public A |
| 16 |
{ |
| 17 |
virtual int c () { return 2; } |
| 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 |
return x; |
| 55 |
} |
| 56 |
|
| 57 |
int |
| 58 |
main (void) |
| 59 |
{ |
| 60 |
{ |
| 61 |
E e; |
| 62 |
} |
| 63 |
if (x != 3) |
| 64 |
abort (); |
| 65 |
} |