<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 704</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="704"></A><H4>704.
  
To which <I>postfix-expression</I>s does overload resolution apply?
</H4>
<B>Section: </B>12.2.2.2&#160; [<A href="https://wg21.link/over.match.call">over.match.call</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Jens Maurer
 &#160;&#160;&#160;

 <B>Date: </B>29 July, 2008<BR>


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



<P>There are several problems with the phrasing of 12.2.2.2 [<A href="https://wg21.link/over.match.call">over.match.call</A>] paragraphs 1 and 3.  Paragraph 1 reads,</P>

<BLOCKQUOTE>

Recall from 7.6.1.3 [<A href="https://wg21.link/expr.call">expr.call</A>], that a <I>function
call</I> is a <I>postfix-expression</I>, possibly nested
arbitrarily deep in parentheses, followed by an optional
<I>expression-list</I> enclosed in parentheses:

<UL>
<TT>(</TT> ... <TT>(</TT><SUB><I>opt</I></SUB> <I>postfix-expression</I> <TT>)</TT> ... <TT>)</TT><SUB><I>opt</I></SUB> <TT>(</TT> <I>expression-list<SUB>opt</SUB></I> <TT>)</TT>
</UL>

Overload resolution is required if the <I>postfix-expression</I>
is the name of a function, a function template (13.7.7 [<A href="https://wg21.link/temp.fct">temp.fct</A>]), an object of class type, or a set of
pointers-to-function.

</BLOCKQUOTE>

<P>Aside from the fact that directly addressing the reader
(&#8220;Recall that...&#8221;) is stylistically incongruous with
the rest of the Standard, as well as the fact that 7.6.1.3 [<A href="https://wg21.link/expr.call">expr.call</A>] doesn't mention parentheses at all, this wording
does not cover member function calls: a member access expression
isn't &#8220;the name&#8221; of anything.  This should perhaps be
reworded to refer to being either an <I>id-expression</I> or the
<I>id-expression</I> in a member access expression.  This could
be either by using two lines in the &#8220;of the form&#8221;
citation or in the discussion following the syntax reference.
</P>

<P>In addition, paragraph 3 refers to &#8220;a
<I>postfix-expression</I> of the form <TT>&amp;F</TT>,&#8221;
which is an oxymoron: <TT>&amp;F</TT> is a
<I>unary-expression</I>, not a <I>postfix-expression</I>.  One
possibility would be to explicitly include the parentheses needed
in this case, i.e., &#8220;a <I>postfix-expression</I> of the
form <TT>(&amp;F)</TT>...&#8221;</P>

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

<P>Replace the entirety of 12.2.2.2 [<A href="https://wg21.link/over.match.call">over.match.call</A>] with
the following two paragraphs:</P>

<BLOCKQUOTE>

<P>In a function call (7.6.1.3 [<A href="https://wg21.link/expr.call">expr.call</A>])</P>

<UL>
<I>postfix-expression</I> <TT>(</TT> <I>expression-list<SUB>opt</SUB></I> <TT>)</TT>
</UL>

<P>if the <I>postfix-expression</I> denotes a set of overloaded
functions and/or function templates, overload resolution is applied as
specified in 12.2.2.2.2 [<A href="https://wg21.link/over.call.func">over.call.func</A>]. If the <I>postfix-expression</I>
denotes an object of class type, overload resolution is applied as
specified in 12.2.2.2.3 [<A href="https://wg21.link/over.call.object">over.call.object</A>].</P>

<P>If the <I>postfix-expression</I> denotes the address of a set of
overloaded functions and/or function templates, overload resolution is
applied using that set as described above. If the function selected by
overload resolution is a non-static member function, the program is
ill-formed. [<I>Note:</I> The resolution of the address of an overload
set in other contexts is described in 12.3 [<A href="https://wg21.link/over.over">over.over</A>]. &#8212;<I>end note</I>]</P>

</BLOCKQUOTE>

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