This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-04-13


2614. Unspecified results for class member access

Section: 7.6.1.5  [expr.ref]     Status: C++23     Submitter: Andrey Erokhin     Date: 2021-10-27

[Accepted as a DR at the November, 2022 meeting.]

Subclause 7.6.1.5 [expr.ref] paragraph 6 specifies:

If E2 is declared to have type “reference to T”, then E1.E2 is an lvalue; the type of E1.E2 is T. Otherwise, ...

This does not specifiy which object or functiom the resulting lvalue designates. A similar problem exists with member enumerators:

If E2 is a member enumerator and the type of E2 is T, the expression E1.E2 is a prvalue. The type of E1.E2 is T.

Proposed resolution (approved by CWG 2022-09-23):

  1. Split and change in 7.6.1.5 [expr.ref] paragraph 6 as follows:

    If E2 is declared to have type “reference to T”, then E1.E2 is an lvalue; the type of E1.E2 is T.

    Otherwise, ...

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

    If E2 is a member enumerator and the type of E2 is T, the expression E1.E2 is a prvalue. The type of E1.E2 is T .