<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2293</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="2293"></A><H4>2293.
  
Requirements for <I>simple-template-id</I> used as a <I>class-name</I>
</H4>
<B>Section: </B>Clause 11&#160; [<A href="https://wg21.link/class">class</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>CWG
 &#160;&#160;&#160;

 <B>Date: </B>2016-06-22<BR>


<P>[Accepted as a DR at the June, 2018 (Rapperswil) meeting.]</P>

<P>There is currently no requirement that a <I>simple-template-id</I>
used as a <I>class-name</I> (Clause 11 [<A href="https://wg21.link/class#1">class</A>] paragraph 1) must
have template arguments for every template parameter that does not have
a default template argument.</P>

<P><B>Proposed resolution (March, 2018):</B></P>

<OL>
<LI><P>Change _N4868_.6.4.1 [<A href="https://wg21.link/basic.scope.declarative#1">basic.scope.declarative</A>] paragraph 1 as follows:</P></LI>

<BLOCKQUOTE>

Every name is introduced in some portion of program text called a
declarative region, which is the largest part of the program in which that
name is <DEL><I>valid</I></DEL> <INS>valid</INS>, that is, in which that
name may be used as an unqualified name to refer to the same entity. In
general...

</BLOCKQUOTE>

<LI><P>Add the following as a new paragraph after 13.3 [<A href="https://wg21.link/temp.names#7">temp.names</A>] paragraph 7:
</P></LI>

<BLOCKQUOTE>

<P>A <I>template-id</I> that names an alias template specialization is
a <I>type-name</I>.</P>

<P><INS>A <I>template-id</I> is <I>valid</I> if</INS></P>

<UL>
<LI><P><INS>there are at most as many arguments as there are parameters
or a parameter is a template parameter pack
(13.7.4 [<A href="https://wg21.link/temp.variadic">temp.variadic</A>]),</INS></P></LI>

<LI><P><INS>there is an argument for each non-deducible non-pack parameter that
does not have a default <I>template-argument</I>,</INS></P></LI>

<LI><P><INS>each <I>template-argument</I> matches the corresponding
<I>template-parameter</I> (13.4 [<A href="https://wg21.link/temp.arg">temp.arg</A>]),</INS></P></LI>

<LI><P><INS>substitution of each template argument into the following template
parameters (if any) succeeds, and</INS></P></LI>

<LI><P>
<INS>if the <I>template-id</I> is non-dependent, the associated
constraints are satisfied as specified in the next paragraph.</INS>
</P></LI>

</UL>

<P><INS>A <I>simple-template-id</I> shall be valid unless it names a
function template specialization
(13.10.3 [<A href="https://wg21.link/temp.deduct">temp.deduct</A>]). [<I>Example:</I></INS></P>

<PRE>
<INS>  template&lt;class T, T::type n = 0&gt; class X;
  struct S {
    using type = int;
  };
  using T1 = X&lt;S, int, int&gt;;  //<SPAN CLASS="cmnt"> error: too many arguments</SPAN>
  using T2 = X&lt;&gt;;             //<SPAN CLASS="cmnt"> error: no default argument for first template parameter</SPAN>
  using T3 = X&lt;1&gt;;            //<SPAN CLASS="cmnt"> error: value </SPAN>1<SPAN CLASS="cmnt"> does not match type-parameter</SPAN>
  using T4 = X&lt;int&gt;;          //<SPAN CLASS="cmnt"> error: substitution failure for second template parameter</SPAN>
  using T5 = X&lt;S&gt;;            //<SPAN CLASS="cmnt"> OK</SPAN></INS>
</PRE>

<P><INS>&#8212;<I>end example</I>]</INS></P>

</BLOCKQUOTE>

<LI><P>Change 13.10.3 [<A href="https://wg21.link/temp.deduct#2">temp.deduct</A>] paragraph 2 as follows, converting
from bullets to running text:</P></LI>

<BLOCKQUOTE>

<P>When an explicit template argument list is specified, if the <DEL>template
arguments are not compatible with the template parameter list or do not
result in a valid function type as described below</DEL> <INS>given
<I>template-id</I> is invalid (13.3 [<A href="https://wg21.link/temp.names">temp.names</A>])</INS>, type
deduction fails.  <DEL>Specifically, the following steps are performed when
evaluating an explicitly specified template argument list with respect to a
given function template:</DEL>
</P>

<UL>
<LI><P><DEL>If the specified template arguments do not match the template
parameters in kind (i.e., type, non-type, template), or if there are more
arguments than there are parameters and no parameter is a template
parameter pack, or if there is not an argument for each non-pack parameter,
type deduction fails.</DEL></P></LI>

<LI><P><DEL>If any non-type argument does not match the type of the
corresponding non-type template parameter, and is not convertible to the
type of the corresponding non-type parameter as specified in
13.4.3 [<A href="https://wg21.link/temp.arg.nontype">temp.arg.nontype</A>], type deduction fails.</DEL></P></LI>

<LI><P>The specified template argument values are substituted for the
corresponding template parameters as specified below.</P></LI>

</UL>

</BLOCKQUOTE>

</OL>

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