| 1 |
// { dg-do run } |
| 2 |
// GROUPS passed destructors |
| 3 |
// dtor file: |
| 4 |
// Message-Id: <[email protected]> |
| 5 |
// From: [email protected] (Jim Nisbet) |
| 6 |
// Subject: gcc 2.2.2 -- c++ bug: destructor called twice (example) |
| 7 |
// Date: 25 Jun 92 18:18:45 GMT |
| 8 |
|
| 9 |
#include <stdio.h> |
| 10 |
|
| 11 |
int things = 0; |
| 12 |
|
| 13 |
class foo { |
| 14 |
public: |
| 15 |
foo() { things++; } |
| 16 |
foo(const foo&) { things++; } |
| 17 |
~foo() { things--; } |
| 18 |
|
| 19 |
int i; |
| 20 |
}; |
| 21 |
|
| 22 |
void |
| 23 |
sub(foo f) { |
| 24 |
; |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
int main() { |
| 29 |
sub(foo()); |
| 30 |
if (things == 0) |
| 31 |
printf ("PASS\n"); |
| 32 |
else |
| 33 |
{ printf ("FAIL\n"); return 1; } |
| 34 |
} |