Debian Codegraph @

gcc/testsuite/g++.dg/other/static11.C

raw
1 // This is a copy of g++.old-deja/g++.pt/static11.C which at one
2 // time got a SEGV for mmix-knuth-mmixware when compiled with
3 // -da (or either -dj or -df).
4 // { dg-do compile }
5 // { dg-options "-da" }
6
7 extern "C" void _exit (int);
8
9 int r = 1;
10
11 struct A
12 {
13 void f(){};
14 A(){ ++r; }
15 ~A(){ r -= 2; _exit (r); }
16 };
17
18 template<class T>
19 struct C
20 {
21 C(){ a.f(); }
22 static A a;
23 };
24
25 template <class T> A C<T>::a;
26 typedef C<int> B;
27
28 int main()
29 {
30 C<int> c;
31 return r;
32 }
33