1 // { dg-do run  }
2 // PRMS Id: 5331
3 // Bug: the return value of foo is constructed in a temporary and then
4 // copied into the return slot.  This is not necessary.
5 
6 int c = 0;
7 
8 struct X {
XX9    X(int i) { }
XX10    X(X const &XX) { c = 1; }
~XX11    ~X() { }
12 };
13 
foo()14 const X foo() {
15   return X(3);
16 }
17 
main()18 int main()
19 {
20   foo();
21   return c;
22 }
23