Title
Locus of enum-specifier or opaque-enum-declaration
Status
review
Section
6.4.2 [basic.scope.pdecl]
Submitter
Jiang An

Created on 2021-10-03.00:00:00 last changed 2 weeks ago

Messages

Date: 2022-11-20.07:54:16

CWG 2022-11-11

Move the locus to immediately after the enum-head.

Possible resolution:

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]).
Date: 2021-10-03.00:00:00

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.

History
Date User Action Args
2022-11-20 07:54:16adminsetmessages: + msg7045
2022-11-20 07:54:16adminsetstatus: open -> review
2021-10-03 00:00:00admincreate