Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.mike / p2736.C
blob6ae61e89260ae7e53acca4b1ddf290976772f16e
1 // The VxWorks kernel has no implementation of atexit, so local statics
2 // are never destroyed. 
3 // { dg-do run { xfail vxworks_kernel } }
4 // This is a poor test case, it is meant to ensure that function local
5 // statics are destroyed at the right time.  See PR 2736 for details.
6 // prms-id: 2736
8 #include <stdlib.h>
10 int count;
12 struct A {
13   int which;
14   A(int i) :which(i) {
15     // printf("ctor %x\n", this);
16   }
17   ~A() {
18     // printf("dtor %x\n", this);
19     if (++count != which)
20       abort ();
21     }
24 void
25 foo() {
26   static A a(1);
29 A a(2);
31 int main() {
32   foo();