Created on 1999-01-15.00:00:00 last changed 161 months ago
[Voted into WP at April, 2006 meeting.]
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.
Proposed resolution (October, 2004):
This issue is resolved by the resolutions of issue 446.
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.
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.
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?
|2008-10-05 00:00:00||admin||set||status: wp -> cd1|
|2006-11-05 00:00:00||admin||set||status: dr -> wp|
|2006-04-22 00:00:00||admin||set||status: ready -> dr|
|2005-10-22 00:00:00||admin||set||messages: + msg1222|
|2005-10-22 00:00:00||admin||set||messages: + msg1221|
|2005-10-22 00:00:00||admin||set||status: review -> ready|
|2004-11-07 00:00:00||admin||set||messages: + msg1062|
|2004-11-07 00:00:00||admin||set||status: drafting -> review|
|2004-04-09 00:00:00||admin||set||messages: + msg981|
|2000-11-18 00:00:00||admin||set||messages: + msg419|
|2000-11-18 00:00:00||admin||set||status: open -> drafting|