<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 183</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="183"></A><H4>183.
  
<TT>typename</TT> in explicit specializations
</H4>
<B>Section: </B>13.8&#160; [<A href="https://wg21.link/temp.res">temp.res</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>John Spicer
 &#160;&#160;&#160;

 <B>Date: </B>9 Nov 1999<BR>





<P>
<U>John Spicer</U>:
In 13.8 [<A href="https://wg21.link/temp.res#5">temp.res</A>] paragraph 5,

the standard says</P>

<BLOCKQUOTE>
The keyword <TT>typename</TT> shall only be used in
template declarations and definitions...
</BLOCKQUOTE>

My understanding of the intent of this restriction is to say that
<TT>typename</TT> is only allowed in contexts in which template
dependent names can be found, but the wording leaves open to
interpretation whether <TT>typename</TT> is allowed in an explicit
specialization, such as:

<PRE>
    template &lt;class T&gt; struct A {};
    template &lt;class T&gt; struct B { typedef int X; };
    template &lt;&gt; struct A&lt;int&gt; {
        typename B&lt;int&gt;::X x;
    };
</PRE>

My understanding is that such usage is not permitted.
This should be clarified one way or the other.

<P>
<U>Mike Miller</U>:
I agree with your understanding that you are not allowed to
use <TT>typename</TT> in an explicit specialization.  However, I think
the standard already says that &#8212; an explicit specialization
is not a template declaration.  According to the grammar in
Clause 13 [<A href="https://wg21.link/temp#1">temp</A>] paragraph 1,
 a
<I>template-declaration</I> must have a non-empty
<I>template-parameter-list</I>.</P>

<P>
<U>Nathan Myers</U>:
Is there any actual reason for this restriction?  Its only apparent
effect is to make it harder to specialize templates, with no
corresponding benefit.</P>

<P><B>Proposed resolution (10/00):</B></P>

<P>In 13.8 [<A href="https://wg21.link/temp.res#5">temp.res</A>] paragraph 5, replace</P>

<BLOCKQUOTE>

The keyword <TT>typename</TT> shall only be applied to qualified
names, but those names need not be dependent.

</BLOCKQUOTE>

<P>with</P>

<BLOCKQUOTE>

The keyword <TT>typename</TT> shall be applied only to qualified
names, but those names need not be dependent.  The keyword
<TT>typename</TT> shall be used only in contexts in which dependent
names can be used.  This includes template declarations and
definitions but excludes explicit specialization declarations and
explicit instantiation declarations.

</BLOCKQUOTE>

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