OSDN Git Service

* lib/g++-dg.exp (g++-dg-test): Add "repo" option.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.pt / static11.C
1 // { dg-do run  }
2 // Bug: g++ was failing to destroy C<int>::a because it was using two
3 // different sentry variables for construction and destruction.
4 //
5 // Some targets (e.g. those with "set_board_info needs_status_wrapper 1"
6 // in their dejagnu baseboard description) require that the status is
7 // final when exit is entered (or main returns), and not "overruled" by a
8 // destructor calling _exit.  It's not really worth it to handle that.
9 // Skip if target: mmix-knuth-mmixware xtensa-*-elf*
10
11 extern "C" void _exit (int);
12
13 int r = 1;
14
15 struct A
16 {
17   void f(){};
18   A(){ ++r; }
19   ~A(){ r -= 2; _exit (r); }
20 };
21
22 template<class T>
23 struct C
24 {
25   C(){ a.f(); }
26   static A a;
27 };
28
29 template <class T> A C<T>::a;
30 typedef C<int> B;
31
32 int main()
33 {
34   C<int> c;
35   return r;
36 }