<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2442</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="2442"></A><H4>2442.
  
Incorrect requirement for default arguments
</H4>
<B>Section: </B>12.2.3&#160; [<A href="https://wg21.link/over.match.viable">over.match.viable</A>]
 &#160;&#160;&#160;

 <B>Status: </B>C++20
 &#160;&#160;&#160;

 <B>Submitter: </B>S. B. Tam
 &#160;&#160;&#160;

 <B>Date: </B>2019-09-24<BR>


<P>[Adopted as a DR at the November, 2019 meeting.]</P>

<P>(From editorial issue
<A HREF="https://github.com/cplusplus/draft/issues/3235">3235</A>.)</P>

<P>According to 12.2.3 [<A href="https://wg21.link/over.match.viable#2.3">over.match.viable</A>] bullet 2.3 says,</P>

<BLOCKQUOTE>

<P>First, to be a viable function, a candidate function shall
have enough parameters to agree in number with the arguments
in the list.</P>

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

<LI><P>A candidate function having more than <I>m</I>
parameters is viable only if the <I>(m+1)</I><SUP>st</SUP>
parameter has a default argument
(9.3.4.7 [<A href="https://wg21.link/dcl.fct.default">dcl.fct.default</A>]).  [<I>Footnote:</I> According
to 9.3.4.7 [<A href="https://wg21.link/dcl.fct.default">dcl.fct.default</A>], parameters following
the <I>(m+1)</I><SUP>st</SUP> parameter must also have
default arguments. &#8212;<I>end footnote</I>] For the
purposes of overload resolution, the parameter list is
truncated on the right, so that there are exactly <I>m</I>
parameters.</P></LI>

</UL>

</BLOCKQUOTE>

<P>However, this is incorrect; 9.3.4.7 [<A href="https://wg21.link/dcl.fct.default#4">dcl.fct.default</A>] paragraph 4
permits parameter packs to follow parameters with
default arguments.</P>

<P><B>Proposed resolution (October, 2019):</B></P>

<P>Change 12.2.3 [<A href="https://wg21.link/over.match.viable#2.3">over.match.viable</A>] bullet 2.3 as follows:</P>

<BLOCKQUOTE>

<UL>
<LI><P>A candidate function having more than <I>m</I>
parameters is viable only if <DEL>the <I>(m+1)</I><SUP>st</SUP>
parameter has a default argument
(9.3.4.7 [<A href="https://wg21.link/dcl.fct.default">dcl.fct.default</A>]).  [<I>Footnote:</I> According
to 9.3.4.7 [<A href="https://wg21.link/dcl.fct.default">dcl.fct.default</A>], parameters following
the <I>(m+1)</I><SUP>st</SUP> parameter must also have
default arguments. &#8212;<I>end footnote</I>]</DEL>
<INS>all parameters following the <I>m</I><SUP>th</SUP> have
default arguments (9.3.4.7 [<A href="https://wg21.link/dcl.fct.default">dcl.fct.default</A>]).</INS> For
the purposes of overload resolution, the parameter list is
truncated on the right, so that there are exactly <I>m</I>
parameters.</P></LI>

</UL>

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