<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1558</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="1558"></A><H4>1558.
  
Unused arguments in alias template specializations
</H4>
<B>Section: </B>13.7.8&#160; [<A href="https://wg21.link/temp.alias">temp.alias</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Nikolay Ivchenkov
 &#160;&#160;&#160;

 <B>Date: </B>2012-09-19<BR>


<P>[Moved to DR at the November, 2014 meeting.]</P>



<P>The treatment of unused arguments in an alias template specialization
is not specified by the current wording of 13.7.8 [<A href="https://wg21.link/temp.alias">temp.alias</A>].
For example:</P>

<PRE>
  #include &lt;iostream&gt;

  template &lt;class T, class...&gt;
    using first_of = T;

  template &lt;class T&gt;
    first_of&lt;void, typename T::type&gt; f(int)
      { std::cout &lt;&lt; "1\n"; }

  template &lt;class T&gt;
    void f(...)
      { std::cout &lt;&lt; "2\n"; }

  struct X { typedef void type; };

  int main() {
    f&lt;X&gt;(0);
    f&lt;int&gt;(0);
  }
</PRE>

<P>Is the reference to <TT>first_of&lt;void, T::type&gt;</TT> with
<TT>T</TT> being <TT>int</TT> equivalent to simply <TT>void</TT>, or
is it a substitution failure?</P>

<P>(See also issues <A HREF="1430.html">1430</A>,
<A HREF="1520.html">1520</A>, and <A HREF="1554.html">1554</A>.)</P>

<P><B>Notes from the October, 2012 meeting:</B></P>

<P>The consensus of CWG was to treat this case as substitution
failure.</P>

<P><B>Proposed resolution (February, 2014):</B></P>

<P>Add the following as a new paragraph before 13.7.8 [<A href="https://wg21.link/temp.alias#3">temp.alias</A>] paragraph 3:
</P>

<BLOCKQUOTE>

<P>When a <I>template-id</I> refers to the specialization of an alias
template, it is equivalent...</P>

<P><INS>However, if the <I>template-id</I> is dependent, subsequent
template argument substitution still applies to the <I>template-id</I>.
[<I>Example:</I></INS></P>

<PRE>
<INS>  template&lt;typename...&gt; using void_t = void;
  template&lt;typename T&gt; void_t&lt;typename T::foo&gt; f();
  f&lt;int&gt;(); //<SPAN CLASS="cmnt"> error, </SPAN>int<SPAN CLASS="cmnt"> does not have a nested type </SPAN>foo</INS>
</PRE>

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

<P>The <I>type-id</I> in an alias template declaration shall not refer...</P>

</BLOCKQUOTE>

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