summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/init1.C
blob: 5bc1ea4a9ac975e767fee09e3f53f15911720ee3 (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
// The VxWorks kernel has no implementation of atexit, so local statics
// are never destroyed. 
// { dg-do run { xfail vxworks_kernel } }
int count;

extern "C" void _exit(int);

struct C {
  ~C() { if (count != 1) _exit(1); }
} c;

class A {
public:
  ~A () { ++count; }
};

void f() {
  static A a;
}

void g() {
  // Since this isn't constructed, we can't destruct it.
  static A a;
}

int main () {
  f();
}