<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1406</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="1406"></A><H4>1406.
  
<I>ref-qualifier</I>s and added parameters of non-static member function templates
</H4>
<B>Section: </B>13.7.7.3&#160; [<A href="https://wg21.link/temp.func.order">temp.func.order</A>]
 &#160;&#160;&#160;

 <B>Status: </B>CD3
 &#160;&#160;&#160;

 <B>Submitter: </B>Richard Smith
 &#160;&#160;&#160;

 <B>Date: </B>2011-10-21<BR>


<P>[Moved to DR at the October, 2012 meeting.]</P>



<P>In describing the partial ordering of function templates,
13.7.7.3 [<A href="https://wg21.link/temp.func.order#3">temp.func.order</A>] paragraph 3 says,</P>

<BLOCKQUOTE>

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 &#8220;reference to <I>cv</I>
<TT>A</TT>,&#8221; where <I>cv</I> are the cv-qualifiers of the function
template (if any) and <TT>A</TT> is the class of which the function
template is a member. [<I>Note:</I> 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. &#8212;<I>end note</I>]

</BLOCKQUOTE>

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

<P><B>Proposed resolution (February, 2012):</B></P>

<P>Change 13.7.7.3 [<A href="https://wg21.link/temp.func.order#3">temp.func.order</A>] paragraph 3 as follows:</P>

<BLOCKQUOTE>

To produce the transformed template, for each type, non-type, or
template template parameter (including template parameter packs
(13.7.4 [<A href="https://wg21.link/temp.variadic">temp.variadic</A>]) 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 <INS>of some
class <TT>A</TT></INS>, that function template is considered to have a
new first parameter inserted in its function parameter
list. <DEL>The</DEL> <INS>Given <I>cv</I> as the cv-qualifiers of the
function template (if any), the</INS> new parameter is of type
&#8220;<INS>rvalue</INS> reference to <I>cv</I>
<TT>A</TT><DEL>,</DEL>&#8221; <INS>if the optional
<I>ref-qualifier</I> of the function template is <TT>&amp;&amp;</TT>,
or of type &#8220;lvalue reference to <I>cv</I> <TT>A</TT>&#8221;
otherwise</INS> <DEL>where <I>cv</I> are the cv-qualifiers of the
function template (if any) and <TT>A</TT> is the class of which the
function template is a member</DEL>. [<I>Note:</I>...

</BLOCKQUOTE>

<BR><BR>
</BODY>
</HTML>
