Title
Require glvalue when splicing direct base class relationship
Status
ready
Section
7.6.1.5 [expr.ref]
Submitter
US

Created on 2025-10-01.00:00:00 last changed 1 month ago

Messages

Date: 2025-11-06.23:04:52

Proposed resolution (approved by CWG 2025-11-03):

  1. Change in 6.8.7 [class.temporary] bullet 6.4 as follows:

    • ...
    • a class member access (7.6.1.5 [expr.ref]) using the . operator where the left operand is one of these expressions and the right operand designates a non-static data member (11.4.1 [class.mem.general]) of non-reference type or a direct base class relationship (11.7.1 [class.derived.general]),
    • ...
  2. Change in 7.6.1.5 [expr.ref] paragraph 2 as follows:

    For a dot that is followed by an expression that designates a static member or an enumerator, the first expression is a discarded-value expression (7.2.3 [expr.context]); if the expression after the dot designates a non-static data member (11.4.1 [class.mem.general]) or a direct base class relationship (11.7.1 [class.derived.general], the first expression shall be a glvalue. A postfix expression that is followed by an arrow shall be a prvalue having pointer type.
Date: 2025-11-06.23:04:52

Possible resolution (reviewed by CWG 2025-10-10) [SUPERSEDED]:

Change in 7.6.1.5 [expr.ref] paragraph 2 as follows:

For a dot that is followed by an expression that designates a static member (11.4.9.3 [class.static.data]) or an enumerator (9.8.1 [dcl.enum]), the first expression is a discarded-value expression (7.2.3 [expr.context]); if the expression after the dot designates a non-static data member (11.4.1 [class.mem.general]) or a direct base class relationship (11.7.1 [class.derived.general], the first expression shall be a glvalue. A postfix expression that is followed by an arrow shall be a prvalue having pointer type.
Date: 2025-11-06.23:04:52
N5028 comment USĀ 29-062

In a class member access, if the second expression represents a direct base class relationship, the first expression should be required to be a glvalue.

History
Date User Action Args
2025-11-06 23:04:52adminsetmessages: + msg8369
2025-11-05 12:07:23adminsetstatus: review -> ready
2025-10-10 20:24:52adminsetmessages: + msg8142
2025-10-10 20:24:52adminsetstatus: open -> review
2025-10-01 00:00:00admincreate