1// { dg-do run }
2// PRMS Id: 5368
3// Bug: the X temporary in foo() is not destroyed.
4
5int c = 0;
6
7struct X {
8 X (int) { c++; }
9 ~X() { c--; }
10};
11
12struct Y {
13 Y(const X &) { }
14};
15
16Y foo() {
17 return X(3);
18}
19
20int main()
21{
22 foo();
23 return c;
24}
25