Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / g++.dg / eh / uncaught1.C
blob2aa1068b090dc2f4b390df5c3253b7ec2aa18814
1 // PR libstdc++/10606
2 // { dg-do run }
4 #include <exception>
5 #include <cstdlib>
8 struct Check {
9   int obj1, obj2;
10   bool state;
13 static Check const data[] = {
14   { 0, 0, false },      // construct [0]
15   { 1, 0, true  },      // [1] = [0]
16   { 0, 0, true  },      // destruct [0]
17   { 2, 1, true  },      // [2] = [1]
18   { 2, 2, true  },      // destruct [2]
19   { 3, 1, true  },      // [3] = [1]
20   { 3, 3, false },      // destruct [3]
21   { 1, 1, false },      // destruct [1]
22   { 9, 9, false }       // end-of-data
25 static int pos = 0;
27 static void test(int obj1, int obj2, bool state)
29   if (obj1 != data[pos].obj1) abort ();
30   if (obj2 != data[pos].obj2) abort ();
31   if (state != data[pos].state) abort ();
32   pos++;
36 struct S {
37   int id;
38   S ();
39   S (const S &);
40   ~S ();
43 static int next_id = 0;
45 S::S()
46   : id (next_id++)
48   test (id, id, std::uncaught_exception ());
51 S::S(const S &x)
52   : id (next_id++)
54   test (id, x.id, std::uncaught_exception ());
57 S::~S()
59   test (id, id, std::uncaught_exception ());
62 extern void foo (S *);
64 int main()
66   try
67     {
68       try
69         {
70           S s0;
71           throw s0;     // s1 is the exception object
72         }
73       catch (S s2)
74         {
75           throw;
76         }
77     }
78   catch (S s3)
79     {
80     }
82   return 0;