aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.old-deja/g++.other/dtor7.C
blob: c212d947662562c28101ab33fcff9b438406c050 (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
// { dg-do run  }
// { dg-options "-O2" }
// Origin: Mark Mitchell <mitchell@codesourcery.com>

int i;
int j;

struct A
{
  A ();
  A (const A&);
  ~A ();
};

A::A ()
{
  ++i;
}

A::A (const A&)
{
  ++i;
}

A::~A () 
{
  --i;
}

A f () 
{
  return A ();
}

void g (const A&)
{
}

int main ()
{
  g (f ());
  return i;
}