<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2063</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="2063"></A><H4>2063.
  
Type/nontype hiding in class scope
</H4>
<B>Section: </B>_N4868_.6.4.1&#160; [<A href="https://wg21.link/basic.scope.declarative">basic.scope.declarative</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Hubert Tong
 &#160;&#160;&#160;

 <B>Date: </B>2014-12-20<BR>


<P>[Adopted at the February, 2016 meeting.]</P>



<P>The type/nontype hiding rules (&#8220;<TT>struct stat</TT>
hack&#8221;) do not apply in class scope.  This is a C
compatibility issue:</P>

<PRE>
  struct A {
    struct B { int x; } b;
    int B;    // Permitted in C
  };
</PRE>

<P>Since the type/nontype hiding rules exist for C compatibility,
should this example be supported?</P>

<P><B>Proposed resolution (September, 2015):</B></P>

<P>Change _N4868_.6.4.1 [<A href="https://wg21.link/basic.scope.declarative#4">basic.scope.declarative</A>] paragraph 4 as follows:</P>

<BLOCKQUOTE>

<P>Given a set of declarations in a single declarative region, each of which
specifies the same unqualified name,</P>

<UL>
<LI><P>they shall all refer to the same entity, or all refer to
functions and function templates; or</P></LI>

<LI>

<P>exactly one declaration shall declare a class name or enumeration name
that is not a typedef name and the other declarations shall all refer to
the same variable<INS>, non-static data member,</INS> or enumerator, or all
refer to functions and function templates; in this case the class name or
enumeration name is hidden (_N4868_.6.4.10 [<A href="https://wg21.link/basic.scope.hiding">basic.scope.hiding</A>]). [<I>Note:</I> A
namespace name or a class template name must be unique in its declarative
region (9.9.3 [<A href="https://wg21.link/namespace.alias">namespace.alias</A>], Clause 13 [<A href="https://wg21.link/temp">temp</A>]).
&#8212;<I>end note</I>]</P>
</LI>

</UL>

</BLOCKQUOTE>

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