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

2024-03-20


1446. Member function with no ref-qualifier and non-member function with rvalue reference

Section: 13.7.7.3  [temp.func.order]     Status: CD4     Submitter: Jason Merrill     Date: 2012-02-07

[Moved to DR at the November, 2014 meeting.]

A member function with no ref-qualifier can be called for a class prvalue, as can a non-member function whose first parameter is an rvalue reference to that class type. However, 13.7.7.3 [temp.func.order] does not handle this case.

Proposed resolution (February, 2014):

Change 13.7.7.3 [temp.func.order] paragraph 3 as follows:

...If only one of the function templates M is a non-static member of some class A, that function template M is considered to have a new first parameter inserted in its function parameter list. Given cv as the cv-qualifiers of the function template M (if any), the new parameter is of type “rvalue reference to cv A” if the optional ref-qualifier of the function template M is &&, or if M has no ref-qualifier and the first parameter of the other template has rvalue reference type. Otherwise, the new parameter is of type “lvalue reference to cv Aotherwise. [Note: This allows a non-static member to be ordered with respect to a nonmember function and for the results to be equivalent to the ordering of two equivalent nonmembers. —end note] [Example:...