<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 731</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="731"></A><H4>731.
  
Omitted reference qualification of member function type
</H4>
<B>Section: </B>7.6.1.5&#160; [<A href="https://wg21.link/expr.ref">expr.ref</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Daniel Kr&#252;gler
 &#160;&#160;&#160;

 <B>Date: </B>6 October, 2008<BR><BR>


<A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3086.html#DE5">N2800 comment
  DE&#160;5<BR></A>
<A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3086.html#DE10">N2800 comment
  DE&#160;10<BR></A>
<A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3086.html#DE12">N2800 comment
  DE&#160;12<BR></A>

<P>[Voted into WP at October, 2009 meeting.]</P>



<P>There are several places in the Standard that were overlooked when
reference qualification of member functions was added.  For example,
7.6.1.5 [<A href="https://wg21.link/expr.ref#4">expr.ref</A>] paragraph 4, bullet 3, sub-bullet 2 says,</P>

<BLOCKQUOTE>

...if <TT>E1.E2</TT> refers to a non-static member function, and the
type of <TT>E2</TT> is &#8220;function of parameter-type-list
<I>cv</I> returning <TT>T</TT>&#8221;, then...

</BLOCKQUOTE>

<P>This wording incorrectly excludes member functions declared with a
<I>ref-qualifier</I>.</P>

<P>Another place that should consider reference qualification is
7.6.4 [<A href="https://wg21.link/expr.mptr.oper">expr.mptr.oper</A>]; it should not be possible to invoke an
&amp;-qualified member function with an rvalue object expression.</P>

<P>A third place is 9.10 [<A href="https://wg21.link/namespace.udecl#15">namespace.udecl</A>] paragraph 15, which
does not mention reference qualification in connection with the
hiding/overriding of member functions brought in from a base class
via a <I>using-declaration</I>.</P>

<P><B>Proposed resolution (September, 2009):</B></P>

<OL>
<LI><P>Change 7.6.1.5 [<A href="https://wg21.link/expr.ref#4">expr.ref</A>] paragraph 4, bullet 3,
sub-bullet 2 as follows:</P></LI>

<UL>
<LI><P>...</P></LI>

<UL>
<LI><P>...</P></LI>

<LI><P>Otherwise, if <TT>E1.E2</TT> refers to a non-static member
function and the type of <TT>E2</TT> is &#8220;function of
parameter-type-list <I>cv</I>
<INS><I>ref-qualifier<SUB>opt</SUB></I></INS> returning
<TT>T</TT>&#8221;, then <TT>E1.E2</TT> is an rvalue.  The expression
designates a non-static member function...</P></LI>

</UL>

</UL>

<LI><P>Change 7.6.4 [<A href="https://wg21.link/expr.mptr.oper#6">expr.mptr.oper</A>] paragraph 6 as follows:</P></LI>

<BLOCKQUOTE>

...&#8212;<I>end example</I>] <INS>In a <TT>.*</TT> expression whose object
expression is an rvalue, if the second operand is a pointer to member
function with <I>ref-qualifier</I> <TT>&amp;</TT>, the program is
ill-formed. In a <TT>-&gt;*</TT> expression, or in a <TT>.*</TT>
expression whose object expression is an lvalue, if the second operand
is a pointer to member function with <I>ref-qualifier</I>
<TT>&amp;&amp;</TT>, the program is ill-formed.</INS>  The result of a
<TT>.*</TT> expression is an lvalue only if its first operand is an
lvalue and...

</BLOCKQUOTE>

<LI><P>Change 9.10 [<A href="https://wg21.link/namespace.udecl#15">namespace.udecl</A>] paragraph 15 as follows:</P></LI>

<BLOCKQUOTE>

When a <I>using-declaration</I> brings names from a base class into a
derived class scope, member functions and member function templates in
the derived class override and/or hide member functions and member
function templates with the same name, parameter-type-list
(9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>]), <DEL>and</DEL> cv-qualification<INS>, and
<I>ref-qualifier</I> (if any)</INS> in a base class (rather than
conflicting). [<I>Note:</I>...

</BLOCKQUOTE>

</OL>

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