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

2024-12-19


2458. Value category of expressions denoting non-static member functions

Section: 7.6.1.5  [expr.ref]     Status: CD6     Submitter: Andrey Erokhin     Date: 2020-07-04

[Accepted as a DR at the June, 2021 meeting.]

Expressions denoting non-static member functions are currently classified as prvalues (7.5.5.3 [expr.prim.id.qual] paragraph 2; 7.6.1.5 [expr.ref] bullet 6.3.2; and 7.6.4 [expr.mptr.oper] paragraph 6). It would simplify the specification if such expressions were categorized as lvalues. (See also this pull request.)

Notes from the August, 2020 teleconference:

CWG preferred that the unbound case (i.e., &X::f) should be an lvalue, while the bound case should be a prvalue.

Proposed resolution (April, 2021):

  1. Change 7.5.5.3 [expr.prim.id.qual] paragraph 5, converting the running text into a bulleted list, as follows:

  2. The result of a qualified-id Q is the entity it denotes (6.5.5 [basic.lookup.qual]). The type of the expression is the type of the result. The result is an lvalue if the member is

    and a prvalue otherwise.

  3. Change 7.6.2.2 [expr.unary.op] paragraph 3 as follows:

  4. The result of the The operand of the unary & operator shall be an lvalue of some type T. The result is a pointer to its operand prvalue.

[Drafting note: neither 7.6.1.5 [expr.ref] bullet 6.3.2,

nor 7.6.4 [expr.mptr.oper] paragraph 6,

...The result of a .* expression whose second operand is a pointer to a member function is a prvalue...

requires any change.]