This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115f. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-06
[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):
Change 7.5.5.3 [expr.prim.id.qual] paragraph 5, converting the running text into a bulleted list, as follows:
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
a function other than a non-static member function,
a non-static member function if Q is the operand of a unary & operator,
a variable,
a structured binding (9.6 [dcl.struct.bind]), or
a static member function, ora data member,
and a prvalue otherwise.
Change 7.6.2.2 [expr.unary.op] paragraph 3 as follows:
The result of theThe operand of the unary & operator shall be an lvalue of some type T. The result is apointer to its operandprvalue.
If the operand is a qualified-id naming a non-static or variant member m of some class C
with type T, the result has type “pointer to member of class C of type T” andis a prvalue designatingdesignates C::m.Otherwise,
if the operand is an lvalue of type T,theresulting expression is a prvalue ofresult has type “pointer to T”whose result is a pointerand points to the designated object (6.7.1 [intro.memory]) or function (6.8.4 [basic.compound]). [Note 2: In particular, taking the address of a variable of type “cv T” yields a pointer of type “pointer to cv T”. —end note]
Otherwise, the program is ill-formed.
[Drafting note: neither 7.6.1.5 [expr.ref] bullet 6.3.2,
Otherwise (when E2 refers to a non-static member function), E1.E2 is a prvalue. The expression can be used only as the left-hand operand of a member function call (11.4.2 [class.mfct]). [Note 5: Any redundant set of parentheses surrounding the expression is ignored (7.5.4 [expr.prim.paren]). —end note]
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.]