<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2516</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="2516"></A><H4>2516.
  
Locus of <I>enum-specifier</I> or <I>opaque-enum-declaration</I>
</H4>
<B>Section: </B>6.4.2&#160; [<A href="https://wg21.link/basic.scope.pdecl">basic.scope.pdecl</A>]
 &#160;&#160;&#160;

 <B>Status: </B>C++23
 &#160;&#160;&#160;

 <B>Submitter: </B>Jiang An
 &#160;&#160;&#160;

 <B>Date: </B>2021-10-03<BR>


<P>[Accepted as a DR at the February, 2023 meeting.]</P>

<P>According to 6.4.2 [<A href="https://wg21.link/basic.scope.pdecl#3">basic.scope.pdecl</A>] paragraph 3,</P>

<BLOCKQUOTE>

The locus of an <I>enum-specifier</I>
or <I>opaque-enum-declaration</I> is immediately after the
identifier (if any) in it (9.8.1 [<A href="https://wg21.link/dcl.enum">dcl.enum</A>]).

</BLOCKQUOTE>

<P>Equivalent wording has been present for a very long time;
see, for instance, <A HREF="1482.html">issue 1482</A>.
However, most or all implementations reject the example from
that issue:</P>

<PRE>
   template&lt;typename T&gt; struct S { typedef char I; };
   enum E: S&lt;E&gt;::I { e };   //<SPAN CLASS="cmnt"> Implementations say </SPAN>E<SPAN CLASS="cmnt"> is undeclared in </SPAN>S&lt;E&gt;
</PRE>

<P>In addition to recognizing current implementation
practice, it would be practically useful if the locus were
specified instead as after the <I>enum-head</I> or complete
<I>opaque-enum-declaration</I>, as it would allow use of
SFINAE in <TT>std::is_scoped_enum</TT> to distinguish between
scoped and unscoped enumerations rather than requiring
special compiler support.</P>

<P><B>CWG 2022-11-11</B></P>

<P>Move the locus to immediately after the <I>enum-head</I>.</P>

<P><B>Proposed resolution (approved by CWG 2023-02-06):</B></P>

<BLOCKQUOTE>

The locus of an <I>enum-specifier</I>
<DEL>or <I>opaque-enum-declaration</I></DEL> is immediately after <DEL>the <I>identifier</I>
(if any) in it</DEL> <INS>its <I>enum-head</I>; the locus of an <I>opaque-enum-declaration</I> is immediately after it</INS> (9.8.1 [<A href="https://wg21.link/dcl.enum">dcl.enum</A>]).

</BLOCKQUOTE>

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