1 // { dg-do run  }
2 // GROUPS passed destructors
3 // dtor file:
4 // Message-Id: <1992Jun25.181845.18886@leland.Stanford.EDU>
5 // From: niz@leland.stanford.edu (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:
foo()15    foo() { things++; }
foo(const foo &)16    foo(const foo&) { things++; }
~foo()17    ~foo() { things--; }
18 
19    int i;
20 };
21 
22 void
sub(foo f)23 sub(foo f) {
24    ;
25 }
26 
27 
main()28 int main() {
29    sub(foo());
30    if (things == 0)
31      printf ("PASS\n");
32    else
33      { printf ("FAIL\n"); return 1; }
34 }
35