2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.jason / temporary3.C
blob7d96386b705583b4de0eb713f01225cb03d2e7f2
1 // { dg-do run  }
2 // Bug: the temporary returned from f is elided, causing a to be constructed
3 // twice but only destroyed once.
5 extern "C" int printf (const char *, ...);
7 int c,d;
9 struct A {
10   A (int) { c++; }
11   ~A () { d++; }
12   A (const A&) { c++; }
13   int i;
16 A f ()
17 { return 1; }
19 int main ()
21   {
22     A a (1);
23     a = f ();
24   }
25   printf ("%d %d\n", c, d);
26   return c != d;