<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1894</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="1894"></A><H4>1894.
  
<I>typedef-name</I>s and <I>using-declaration</I>s
</H4>
<B>Section: </B>9.2.4&#160; [<A href="https://wg21.link/dcl.typedef">dcl.typedef</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Richard Smith
 &#160;&#160;&#160;

 <B>Date: </B>2014-03-16<BR>


<P>[Accepted at the November, 2020 meeting as part of paper P1787R6 and
moved to DR at the February, 2021 meeting.]</P>



<P>The resolution of <A HREF="407.html">issue 407</A> does not
cover cases involving <I>using-declaration</I>s.  For example:</P>

<PRE>
  namespace A { struct S {}; }
  namespace B {
    //<SPAN CLASS="cmnt"> This is valid per <A HREF="407.html">issue 407</A></SPAN>
    using A::S;
    typedef A::S S;
    struct S s;
  }
  namespace C {
    //<SPAN CLASS="cmnt"> The typedef does not redefine the name </SPAN>S<SPAN CLASS="cmnt"> in this</SPAN>
    //<SPAN CLASS="cmnt"> scope, so <A HREF="407.html">issue 407</A>'s resolution does not apply.</SPAN>
    typedef A::S S;
    using A::S;
    //<SPAN CLASS="cmnt"> The name lookup here isn't ambiguous, because it only finds one</SPAN>
    //<SPAN CLASS="cmnt"> entity, but it finds both a typedef-name and a non-typedef-name referring</SPAN>
    //<SPAN CLASS="cmnt"> to that entity, so the standard doesn't appear to say whether this is valid.</SPAN>
    struct S s;
  }
</PRE>

<P>The same issue appears with <I>using-directive</I>s:</P>

<PRE>
  namespace D { typedef A::S S; }
  namespace E {
    using namespace A;
    using namespace D;
    struct S s; //<SPAN CLASS="cmnt"> ok? <A HREF="407.html">issue 407</A> doesn't apply here either</SPAN>
  }
</PRE>

<P>One possibility might be to remove the rule that a <I>typedef-name</I>
declaration redefines an already-defined name and instead rely on
<TT>struct stat</TT>-style hiding, taking the non-<I>typedef-name</I>
if name lookup finds both and they refer to the same type.</P>

<P><B>Notes from the June, 2014 meeting:</B></P>

<P>CWG felt that these examples should be well-formed.</P>

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