Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / g++.dg / tc1 / dr193.C
blob5855593e5a98c3cbf9e5fa0e7e2e23007a7e49eb
1 // { dg-do run }
2 // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3 // DR193: Order of destruction of local automatics of destructor 
5 extern "C" void abort(void);
7 namespace N1 {
8   bool a_done = false;
9   struct A
10   { 
11     ~A()
12     {
13       a_done = true;
14     }
15   };
17   struct B
18   { 
19     ~B()
20     {
21       if (!a_done)
22         abort();
23     }
24   };
26   struct C {
27     B x;
28     ~C() {
29       A y;
30     };
31   };
35 namespace N2 {
36   bool a_done = false;
38   template <class>
39   struct A
40   { 
41     ~A()
42     {
43       a_done = true;
44     }
45   };
47   template <class>
48   struct B
49   { 
50     ~B()
51     {
52       if (!a_done)
53         abort();
54     }
55   };
57   template <class T>
58   struct C {
59     B<T> x;
60     ~C() {
61       A<T> y;
62     };
63   };
67 int main(void)
69   N1::C c1;
70   N2::C<void> c2;
71   return 0;