Home | History | Annotate | Download | only in jni
      1 // { dg-do run  }
      2 // Bug: g++ fails to treat function-try-blocks in ctors specially.
      3 // Submitted by Jason Merrill <jason (at) cygnus.com>
      4 
      5 int c;
      6 int r;
      7 
      8 struct A {
      9   int i;
     10   A(int j) { i = j; }
     11   ~A() { c += i; }
     12 };
     13 
     14 struct B: public A {
     15   A a;
     16   B() try : A(1), a(2)
     17     { throw 1; }
     18   catch (...)
     19     { if (c != 3) r |= 1; }
     20 };
     21 
     22 int main ()
     23 {
     24   try
     25     { B b; }
     26   catch (...)
     27     { c = 0; }
     28 
     29   if (c != 0) r |= 2;
     30 
     31   return r;
     32 }
     33