summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/other/static11.C
blob: e04cbc15438d20beb21950b05ea17e703834cde1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// This is a copy of g++.old-deja/g++.pt/static11.C which at one
// time got a SEGV for mmix-knuth-mmixware when compiled with
// -da (or either -dj or -df).
// { dg-do compile }
// { dg-options "-da" }

extern "C" void _exit (int);

int r = 1;

struct A
{
  void f(){};
  A(){ ++r; }
  ~A(){ r -= 2; _exit (r); }
};

template<class T>
struct C
{
  C(){ a.f(); }
  static A a;
};

template <class T> A C<T>::a;
typedef C<int> B;

int main()
{
  C<int> c;
  return r;
}

// { dg-final { cleanup-rtl-dump "*" } }