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
5 
6 #include <stdlib.h>
7 
8 int count;
9 
10 struct A {
11   int which;
AA12   A(int i) :which(i) {
13     // printf("ctor %x\n", this);
14   }
~AA15   ~A() {
16     // printf("dtor %x\n", this);
17     if (++count != which)
18       abort ();
19     }
20 };
21 
22 void
foo()23 foo() {
24   static A a(1);
25 }
26 
27 A a(2);
28 
main()29 int main() {
30   foo();
31 }
32