This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-19
[Accepted as a DR at the June, 2024 meeting.]
(From submission #528.)
Paper N3055 (A Taxonomy of Expression Value Categories) introduced xvalues. This changed the behavior of well-formed code for typeid and the conditional operator, but corresponding entries in Annex C are missing.
Proposed resolution (approved by CWG 2024-05-31):
Add a new paragraph to C.6.3 [diff.cpp03.expr] as follows:
Affected subclause: 7.6.1.8 [expr.typeid]
Change: Evaluation of operands in typeid.
Rationale: Introduce additional expression value categories.
Effect on original feature: Valid C++ 2003 code that uses xvalues as operands for typeid may change behavior. For example,
void f() { struct B { B() {} virtual ~B() { } }; struct C { B b; }; typeid(C().b); // unevaluated in C++03, evaluated in C++11 }
Add a new paragraph to C.6.3 [diff.cpp03.expr] as follows:
Affected subclause: 7.6.16 [expr.cond]
Change: Fewer copies in the conditional operator.
Rationale: Introduce additional expression value categories.
Effect on original feature: Valid C++ 2003 code that uses xvalues as operands for the conditional operator may change behavior. For example,
void f() { struct B { B() {} B(const B&) { } }; struct D : B {}; struct BB { B b; }; struct DD { D d; }; true ? BB().b : DD().d; // additional copy in C++03, no copy or move in C++11 }