<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2608</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="2608"></A><H4>2608.
  
Omitting an empty template argument list
</H4>
<B>Section: </B>13.10.2&#160; [<A href="https://wg21.link/temp.arg.explicit">temp.arg.explicit</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Anoop Rana
 &#160;&#160;&#160;

 <B>Date: </B>2022-07-03<BR>


<P>[Accepted at the July, 2022 meeting.]</P>



<P>Subclause 13.10.2 [<A href="https://wg21.link/temp.arg.explicit#4">temp.arg.explicit</A>] paragraph 4 specifies:</P>

<BLOCKQUOTE>

Trailing template arguments that can be deduced
(13.10.3 [<A href="https://wg21.link/temp.deduct">temp.deduct</A>]) or obtained from
default <I>template-argument</I>s may be omitted from the list of
explicit <I>template-argument</I>s.
<br>

[<I>Note 1:</I> A trailing template parameter pack
(13.7.4 [<A href="https://wg21.link/temp.variadic">temp.variadic</A>]) not otherwise deduced will be deduced as
an empty sequence of template arguments. &#8212;<I>end note</I>]
<br>

If all of the template arguments can be deduced, they may all be
omitted; in this case, the empty template argument list &lt;&gt;
itself may also be omitted.

</BLOCKQUOTE>

<P>The wording does not allow omitting the empty template argument
list &lt;&gt; if all of the template arguments have been obtained from
default <I>template-argument</I>s.  For example:</P>

<PRE>
  template&lt;typename T = int&gt;
  int f();

  int x = f();      //<SPAN CLASS="cmnt"> ill-formed per the wording</SPAN>
  int (*y)() = f;   //<SPAN CLASS="cmnt"> ditto</SPAN>
</PRE>

<P><B>Proposed resolution (approved by CWG 2022-07-15):</B></P>

<P>Change in 13.10.2 [<A href="https://wg21.link/temp.arg.explicit#4">temp.arg.explicit</A>] paragraph 4 as follows:</P>

<BLOCKQUOTE>

... If all of the template arguments can be deduced <INS>or obtained
from default <I>template-argument</I>s</INS>, they may all be omitted;
in this case, the empty template argument list &lt;&gt; itself may
also be omitted.

</BLOCKQUOTE>

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