1 // PR c++/12253
2 // Bug: We were failing to destroy the temporary A passed to the
3 // constructor for b[0] before going on to construct b[1].
4 
5 // { dg-do run }
6 
7 extern "C" int printf (const char *, ...);
8 
9 int c;
10 int r;
11 
12 struct A
13 {
AA14   A() { printf ("A()\n"); if (c++) r = 1; }
AA15   A(const A&) { printf ("A(const A&)\n"); ++c; }
~AA16   ~A() { printf ("~A()\n"); --c; }
17 };
18 
19 struct B
20 {
21   B(int, const A& = A()) { printf ("B()\n"); }
22 };
23 
main()24 int main()
25 {
26   B b[] = { 0, 0 };
27   return r;
28 }
29