summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/dtor6.C
blob: f8c1d8563cb6bf9ba817ffd18e5c108f6399b090 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// { dg-do run  }
// Origin: Mark Mitchell <mark@codesourcery.com>

extern "C" void abort ();

int count;

struct S
{
  S ();
  S (const S&);
  ~S ();

  int i;
};

S::S ()
{
  i = count++;
}

S::S (const S&)
{
  i = count++;
}

S::~S ()
{
  if (--count != i)
    abort ();
}

void f (S, S)
{
}

int main ()
{
  {
    S s;
    f (s, s);
  }
  return count != 0;
}