Member function with no ref-qualifier and non-member function with rvalue reference
Section [temp.func.order]
Jason Merrill

Created on 2012-02-07.00:00:00 last changed 49 months ago


Date: 2014-11-15.00:00:00

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

Date: 2014-02-15.00:00:00

Proposed resolution (February, 2014):

Change [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:...
Date: 2012-02-07.00:00:00

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, [temp.func.order] does not handle this case.

Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5410
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-03-03 00:00:00adminsetmessages: + msg4848
2014-03-03 00:00:00adminsetstatus: drafting -> ready
2012-02-07 00:00:00admincreate