This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Adopted as paper P0135R1 at the June, 2016 meeting.]
In an example like,
struct S { ~S(); }; struct X { X(); X(const X&); }; struct T { S &&s; X x; }; void f(); void g() { T t = T{ {}, {} }; f(); }
it appears that the current wording allows two ways of handling this:
The copy to t in g is not elided. X(const X&) is called, then ~S() is called, then f() is called.
However, EDG and g++ produce a third behavior: they do not call X(const X&), but they destroy the S() temporary at the end of its full-expression. The current wording does not appear to permit this behavior, but it seems preferable that lifetime extension does not depend on whether copy elision is done.