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

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

 <B>Submitter: </B>Mike Miller
 &#160;&#160;&#160;

 <B>Date: </B>21 Dec 1999<BR>



<P>[Moved to DR at 4/02 meeting.]</P>



<P>
<U>Mike Miller</U>:
A question about <TT>typename</TT> came up in the discussion of
<A HREF="68.html">issue 68</A> that is somewhat relevant
to the idea of omitting
typename in contexts where it is clear that a type is
required: consider something like</P>

<PRE>
        template &lt;class T&gt;
        class X {
            friend class T::nested;
        };
</PRE>

Is <TT>typename</TT> required here?  If so, where would it go?  (The
grammar doesn't seem to allow it anywhere in an
<I>elaborated-type-specifier</I> that has a <I>class-key</I>.)

<P>
<U>Bill Gibbons</U>:
The <TT>class</TT> applies to the last identifier in the qualified name,
since all the previous names must be classes or namespaces.  Since the
name is specified to be a class it does not need <TT>typename</TT>.
[However,] it looks like
13.8 [<A href="https://wg21.link/temp.res#3">temp.res</A>] paragraph 3
requires
<TT>typename</TT> and the following paragraphs
do not exempt this case.  This is not what we agreed on.</P>

<P><B>Proposed resolution (04/01):</B></P>

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

<BLOCKQUOTE>

The keyword <TT>typename</TT> is not permitted in a
<I>base-specifier</I> or in a <I>mem-initializer</I>; in these
contexts a <I>qualified-name</I> that depends on a
<I>template-parameter</I> (13.8.3 [<A href="https://wg21.link/temp.dep">temp.dep</A>]) is
implicitly assumed to be a type name.

</BLOCKQUOTE>

<P>to</P>

<BLOCKQUOTE>

A qualified name used as the name in a <I>mem-initializer-id</I>,
a <I>base-specifier</I>, or an <I>elaborated-type-specifier</I>
(in the <I>class-key</I> and <TT>enum</TT> forms) is implicitly
assumed to name a type, without the use of the <TT>typename</TT>
keyword.  [<I>Note:</I> the <TT>typename</TT> keyword is not
permitted by the syntax of these constructs.]

</BLOCKQUOTE>

<P>(The expected resolution for <A HREF="254.html">issue 254</A> will remove the <TT>typename</TT> forms from the
grammar for <I>elaborated-type-specifier</I>.  If that
resolution is adopted, the parenthetical phrase "(in the
<I>class-key</I> and <TT>enum</TT> forms)" in the preceding
wording should be removed because those will be the only forms
of <I>elaborated-type-specifier</I>.)</P>

<P>This has been consolidated with the edits for some other
issues.  See N1376=02-0034.</P>

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