Title
Lifetime of temporaries in query expressions
Status
cd1
Section
6.7.7 [class.temporary]
Submitter
Steve Adamczyk

Created on 1999-01-15.00:00:00 last changed 161 months ago

Messages

Date: 2006-04-15.00:00:00

[Voted into WP at April, 2006 meeting.]

Date: 2005-10-15.00:00:00

Note (October, 2005):

This issue was overlooked when issue 446 was moved to “ready” status and was thus inadvertently omitted from the list of issues accepted as Defect Reports at the October, 2005 meeting.

Date: 2004-10-15.00:00:00

Proposed resolution (October, 2004):

This issue is resolved by the resolutions of issue 446.

Date: 2004-03-15.00:00:00

Notes from the March 2004 meeting:

We decided that the cleanest model is one in which any "?" operation that returns a class rvalue always copies one of its operands to a temporary and returns the temporary as the result of the operation. (Note that this may involve slicing.) An implementation would be free to optimize this using the rules in _N4750_.15.8 [class.copy] paragraph 15, and in fact we would expect that in many cases compilers would do such optimizations. For example, the compiler could construct both rvalues in the above example into a single temporary, and thus avoid a copy.

See also issue 446.

Date: 2000-10-15.00:00:00

Notes from 10/00 meeting:

Other problematic examples include cases where the temporary from one branch is a base class of the temporary from the other (i.e., where the implementation must remember which type of temporary must be destroyed), or where one branch is a temporary and the other is not. Similar questions also apply to the comma operator. The sense of the core language working group was that implementations should be required to support these kinds of code.

Date: 1999-01-15.00:00:00

In 6.7.7 [class.temporary] paragraph 5, should binding a reference to the result of a "?" operation, each of whose branches is a temporary, extend both temporaries?

Here's an example:

    const SFileName &C = noDir ? SFileName("abc") : SFileName("bcd");

Do the temporaries created by the SFileName conversions survive the end of the full expression?

History
Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2006-11-05 00:00:00adminsetstatus: dr -> wp
2006-04-22 00:00:00adminsetstatus: ready -> dr
2005-10-22 00:00:00adminsetmessages: + msg1222
2005-10-22 00:00:00adminsetmessages: + msg1221
2005-10-22 00:00:00adminsetstatus: review -> ready
2004-11-07 00:00:00adminsetmessages: + msg1062
2004-11-07 00:00:00adminsetstatus: drafting -> review
2004-04-09 00:00:00adminsetmessages: + msg981
2000-11-18 00:00:00adminsetmessages: + msg419
2000-11-18 00:00:00adminsetstatus: open -> drafting
1999-01-15 00:00:00admincreate