2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.mike / p2736.C
bloba0a8b314338e1c24007a066e3c75ac6c4140d245
1 // { dg-do run  }
2 // This is a poor test case, it is meant to ensure that function local
3 // statics are destroyed at the right time.  See PR 2736 for details.
4 // prms-id: 2736
6 #include <stdlib.h>
8 int count;
10 struct A {
11   int which;
12   A(int i) :which(i) {
13     // printf("ctor %x\n", this);
14   }
15   ~A() {
16     // printf("dtor %x\n", this);
17     if (++count != which)
18       abort ();
19     }
22 void
23 foo() {
24   static A a(1);
27 A a(2);
29 int main() {
30   foo();