blob: f151ed08d51e5affcec3329426e8694aa051116c (
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
|
// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 8 Mar 2000 <nathan@codesourcery.com>
// Derived from PR#7
// We need to destroy the thrown object when exiting the catch
// clause. That needs to destroy the original thrown object, not
// the caught one (which might be a base).
static int ok = 0;
struct A
{
A (){}
virtual ~A () {}
};
struct B : virtual A
{
int value;
B ()
:value(10)
{}
~B()
{
if (value == 10)
ok = 1;
}
};
int main()
{
try {
throw B ();
} catch (A & e) {
}
return !ok;
}
|