Title
Unspecified results for class member access
Status
c++23
Section
7.6.1.5 [expr.ref]
Submitter
Andrey Erokhin

Created on 2021-10-27.00:00:00 last changed 17 months ago

Messages

Date: 2022-09-24.20:25:58

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 of type of E1.E2 is T. If E2 is a static data member, E1.E2 designates the object or function to which the reference is bound, otherwise E1.E2 designates the object or function to which the corresponding reference member of E1 is bound.

    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 of type of E1.E2 is T whose value is the value of the enumerator.
Date: 2022-11-15.00:00:00

[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.
History
Date User Action Args
2023-07-16 13:00:43adminsetstatus: open -> c++23
2023-07-16 13:00:43adminsetstatus: drwp -> open
2023-02-18 18:43:04adminsetstatus: dr -> drwp
2022-11-25 05:14:04adminsetstatus: ready -> dr
2022-09-24 20:25:58adminsetstatus: open -> ready
2022-09-19 08:19:02adminsetmessages: + msg6942
2021-10-27 00:00:00admincreate