1// { dg-do run  }
2// Bug: g++ initializes both B::i and B::j before destroying any temps.
3
4extern "C" int printf (const char *, ...);
5
6int c = 0;
7int d = 0;
8int r = 0;
9
10struct A {
11  A() { if (c != d) r = 1; ++c; }
12  A(const A&);  // declare so g++ returns A on the stack
13  ~A() { ++d; }
14  operator int () { return 0; }
15};
16
17A foo ()
18{
19  return A();
20}
21
22struct B {
23  int i;
24  int j;
25  B(): i(foo()), j(foo()) { }
26};
27
28int main()
29{
30  B b;
31  return r;
32}
33