Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / g++.old-deja / g++.law / dtors5.C
blob220372ac1e4ab6434634dbf861d9a85a83cafc6f
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
9 #include <stdio.h>
11 int things = 0;
13 class foo {
14 public:
15    foo() { things++; }
16    foo(const foo&) { things++; }
17    ~foo() { things--; }
19    int i;
22 void
23 sub(foo f) {
24    ;
28 int main() {
29    sub(foo());
30    if (things == 0)
31      printf ("PASS\n");
32    else
33      { printf ("FAIL\n"); return 1; }