2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.eh / vbase4.C
blob748d37f1541642a48f748fa4abeea9c711207576
1 // { dg-do run  }
3 // Copyright (C) 2000 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 8 Mar 2000 <nathan@codesourcery.com>
6 // Derived from PR#7
8 // We need to destroy the thrown object when exiting the catch
9 // clause. That needs to destroy the original thrown object, not
10 // the caught one (which might be a base).
12 static int ok = 0;
14 struct A
16   A (){};
17   virtual ~A () {};
20 struct B : virtual A
22   int value;
23   B ()
24     :value(10)
25     {}
26   ~B()
27   {
28     if (value == 10)
29       ok = 1;
30   }
33 int main()
35   try {
36     throw B ();
37   } catch (A & e) {
38   }
39   return !ok;