OSDN Git Service

* lib/target-supports.exp (check_effective_target_vxworks_kernel):
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.mike / p2736.C
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
7
8 #include <stdlib.h>
9
10 int count;
11
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     }
22 };
23
24 void
25 foo() {
26   static A a(1);
27 }
28
29 A a(2);
30
31 int main() {
32   foo();
33 }