Created on 2024-04-18.00:00:00 last changed 4 months ago
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 }
[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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-07-20 13:52:34 | admin | set | status: ready -> dr |
2024-06-27 04:25:11 | admin | set | status: tentatively ready -> ready |
2024-05-31 21:07:31 | admin | set | messages: + msg7719 |
2024-05-31 21:07:31 | admin | set | status: open -> tentatively ready |
2024-04-18 00:00:00 | admin | create |