gcc/testsuite/g++.old-deja/g++.jason/cleanup.C
raw| 1 | // { dg-do run } |
| 2 | // Bug: continue over object decl calls destructor but not constructor. |
| 3 | |
| 4 | int c = 0; |
| 5 | int d = 0; |
| 6 | extern "C" int printf(const char *,...); |
| 7 | |
| 8 | class Foo { |
| 9 | public: |
| 10 | Foo(){ c++; } |
| 11 | ~Foo(){ d++; } |
| 12 | }; |
| 13 | |
| 14 | int main() |
| 15 | { |
| 16 | for(int i=0;i<2;i++){ |
| 17 | continue; |
| 18 | Foo bar; |
| 19 | } |
| 20 | printf ("%d %d\n", c, d); |
| 21 | if (c == d && d == 0) |
| 22 | return 0; |
| 23 | return 1; |
| 24 | } |