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-04-05


1406. ref-qualifiers and added parameters of non-static member function templates

Section: 13.7.7.3  [temp.func.order]     Status: CD3     Submitter: Richard Smith     Date: 2011-10-21

[Moved to DR at the October, 2012 meeting.]

In describing the partial ordering of function templates, 13.7.7.3 [temp.func.order] paragraph 3 says,

If only one of the function templates is a non-static member, that function template is considered to have a new first parameter inserted in its function parameter list. The new parameter is of type “reference to cv A,” where cv are the cv-qualifiers of the function template (if any) and A is the class of which the function template is a member. [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]

The Standard appears to be silent as to whether the reference is an lvalue or rvalue reference; presumably that should be determined by the ref-qualifier of the member function, if any.

Proposed resolution (February, 2012):

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

To produce the transformed template, for each type, non-type, or template template parameter (including template parameter packs (13.7.4 [temp.variadic]) thereof) synthesize a unique type, value, or class template respectively and substitute it for each occurrence of that parameter in the function type of the template. If only one of the function templates is a non-static member of some class A, that function template is considered to have a new first parameter inserted in its function parameter list. The Given cv as the cv-qualifiers of the function template (if any), the new parameter is of type “rvalue reference to cv A,if the optional ref-qualifier of the function template is &&, or of type “lvalue reference to cv A” otherwise where cv are the cv-qualifiers of the function template (if any) and A is the class of which the function template is a member. [Note:...