[PR c++/84702] ICE with default tmpl arg of overload set
[official-gcc.git] / gcc / testsuite / g++.dg / ext / cleanup-dtor.C
blob58da646704ba0d221484d662709348ac9e277be3
1 // Check that destructors are run after cleanup functions.
2 // { dg-do run }
4 extern "C" void abort ();
6 int i;
8 struct S {
9   ~S() {
10     if (i != 1)
11       abort ();
12     i = 2;
13   }
16 void f(void *) {
17   if (i != 0)
18     abort ();
19   i = 1;
22 int main () {
23   {
24     S s __attribute__((cleanup (f)));
25   }
26   if (i != 2)
27     abort ();