gcc/testsuite/g++.old-deja/g++.mike/p7865.C
raw| 1 | // { dg-do run } |
| 2 | // prms-id: 7865 |
| 3 | |
| 4 | int count; |
| 5 | |
| 6 | struct A { |
| 7 | A() { ++count; } |
| 8 | ~A() { --count; } |
| 9 | }; |
| 10 | |
| 11 | int foo() { return 1; } |
| 12 | |
| 13 | int bar() |
| 14 | { |
| 15 | A a; |
| 16 | for (;;) { |
| 17 | A b; |
| 18 | if (foo()) |
| 19 | return 0; |
| 20 | if (foo()) |
| 21 | return 0; |
| 22 | } |
| 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | int main() { |
| 27 | bar(); |
| 28 | return count; |
| 29 | } |