Title
Missing compatibility entries for xvalues
Status
dr
Section
C.6.3 [diff.cpp03.expr]
Submitter
Jiang An

Created on 2024-04-18.00:00:00 last changed 6 days ago

Messages

Date: 2024-05-31.21:07:31

Proposed resolution (approved by CWG 2024-05-31):

  1. 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
      }
    
  2. 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
      }
    
Date: 2024-06-15.00:00:00

[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:34adminsetstatus: ready -> dr
2024-06-27 04:25:11adminsetstatus: tentatively ready -> ready
2024-05-31 21:07:31adminsetmessages: + msg7719
2024-05-31 21:07:31adminsetstatus: open -> tentatively ready
2024-04-18 00:00:00admincreate