FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.eh / vbase4.C
blob60360864b2b0610c04eef025780cf72b7efd391e
2 // Copyright (C) 2000 Free Software Foundation, Inc.
3 // Contributed by Nathan Sidwell 8 Mar 2000 <nathan@codesourcery.com>
5 // Derived from PR#7
7 // We need to destroy the thrown object when exiting the catch
8 // clause. That needs to destroy the original thrown object, not
9 // the caught one (which might be a base).
11 static int ok = 0;
13 struct A
15   A (){};
16   virtual ~A () {};
19 struct B : virtual A
21   int value;
22   B ()
23     :value(10)
24     {}
25   ~B()
26   {
27     if (value == 10)
28       ok = 1;
29   }
32 int main()
34   try {
35     throw B ();
36   } catch (A & e) {
37   }
38   return !ok;