<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 245</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="245"></A><H4>245.
  
Name lookup in <I>elaborated-type-specifier</I>s
</H4>
<B>Section: </B>6.5.6&#160; [<A href="https://wg21.link/basic.lookup.elab">basic.lookup.elab</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Jack Rouse
 &#160;&#160;&#160;

 <B>Date: </B>14 Sep 2000<BR>


<P>[Voted into WP at April 2003 meeting.]</P>



<P>I have some concerns with the description of name lookup for
elaborated type specifiers in 6.5.6 [<A href="https://wg21.link/basic.lookup.elab">basic.lookup.elab</A>]:</P>

<OL>

<LI>
<P>Paragraph 2 has some parodoxical statements concerning looking up
names that are simple identifers:</P>

<BLOCKQUOTE>
If the <I>elaborated-type-specifier</I> refers to an <I>enum-name</I>
and this lookup does not find a previously declared <I>enum-name</I>,
the <I>elaborated-type-specifier</I> is ill-formed. If the
<I>elaborated-type-specifier</I> refers to an <I>[sic]</I>
<I>class-name</I> and this lookup does not find a previously declared
<I>class-name</I>... the <I>elaborated-type-specifier</I> is a
declaration that introduces the <I>class-name</I> as described in
6.4.2 [<A href="https://wg21.link/basic.scope.pdecl">basic.scope.pdecl</A>]."
</BLOCKQUOTE>

<P>It is not clear how an <I>elaborated-type-specifier</I> can refer
to an <I>enum-name</I> or <I>class-name</I> given that the lookup does
not find such a name and that <I>class-name</I> and <I>enum-name</I>
are not part of the syntax of an <I>elaborated-type-specifier</I>.</P>
</LI>

<LI>
<P>The second sentence quoted above seems to suggest that the name found
will not be used if it is not a class name.  <I>typedef-name</I> names
are ill-formed due to the sentence preceding the quote.  If lookup
finds, for instance, an <I>enum-name</I> then a new declaration will
be created.  This differs from C, and from the enum case, and can have
surprising effects:</P>

<PRE>
    struct S {
       enum E {
           one = 1
       };
       class E* p;     // declares a global class E?
    };
</PRE>

<P>Was this really the intent?  If this is the case then some more
work is needed on 6.5.6 [<A href="https://wg21.link/basic.lookup.elab">basic.lookup.elab</A>].  Note that the
section does not make finding a type template formal ill-formed, as is
done in 9.2.9.5 [<A href="https://wg21.link/dcl.type.elab">dcl.type.elab</A>].  I don't see anything that
makes a type template formal name a <I>class-name</I>.  So the example
in 9.2.9.5 [<A href="https://wg21.link/dcl.type.elab">dcl.type.elab</A>] of <TT>friend class T;</TT> where
<TT>T</TT> is a template type formal would no longer be ill-formed
with this interpretation because it would declare a new class
<TT>T</TT>.</P> </LI>
</OL>

<P>(See also <A HREF="254.html">issue 254</A>.)</P>

<P><B>Notes from the 4/02 meeting:</B></P>

<P>This will be consolidated with the changes for
<A HREF="254.html">issue 254</A>.
See also <A HREF="298.html">issue 298</A>.</P>

<P><B>Proposed resolution (October 2002):</B></P>

<P>As given in N1376=02-0034.  Note that the inserts and strikeouts in
that document do not display
correctly in all browsers; &lt;del&gt; --&gt; &lt;strike&gt;
and &lt;ins&gt; --&gt; &lt;b&gt;, and the
similar changes for the closing delimiters,
seem to do the trick.</P>

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