This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-05-06


2516. Locus of enum-specifier or opaque-enum-declaration

Section: 6.4.2  [basic.scope.pdecl]     Status: C++23     Submitter: Jiang An     Date: 2021-10-03

[Accepted as a DR at the February, 2023 meeting.]

According to 6.4.2 [basic.scope.pdecl] paragraph 3,

The locus of an enum-specifier or opaque-enum-declaration is immediately after the identifier (if any) in it (9.7.1 [dcl.enum]).

Equivalent wording has been present for a very long time; see, for instance, issue 1482. However, most or all implementations reject the example from that issue:

   template<typename T> struct S { typedef char I; };
   enum E: S<E>::I { e };   // Implementations say E is undeclared in S<E>

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

CWG 2022-11-11

Move the locus to immediately after the enum-head.

Proposed resolution (approved by CWG 2023-02-06):

The locus of an enum-specifier or opaque-enum-declaration is immediately after the identifier (if any) in it its enum-head; the locus of an opaque-enum-declaration is immediately after it (9.7.1 [dcl.enum]).