1// { dg-do run } 2// Bug: the temporary returned from f is elided, causing a to be constructed 3// twice but only destroyed once. 4 5extern "C" int printf (const char *, ...); 6 7int c,d; 8 9struct A { 10 A (int) { c++; } 11 ~A () { d++; } 12 A (const A&) { c++; } 13 int i; 14}; 15 16A f () 17{ return 1; } 18 19int main () 20{ 21 { 22 A a (1); 23 a = f (); 24 } 25 printf ("%d %d\n", c, d); 26 return c != d; 27} 28