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

Created on 2021-10-03.00:00:00 last changed 16 months ago

Messages

Date: 2023-02-10.23:01:52

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]).
Date: 2023-02-10.23:01:52

CWG 2022-11-11

Move the locus to immediately after the enum-head.

Date: 2023-02-15.00:00:00

[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.

History
Date User Action Args
2023-07-16 13:00:43adminsetstatus: open -> c++23
2023-07-16 13:00:43adminsetstatus: dr -> open
2023-02-18 18:43:04adminsetstatus: ready -> dr
2023-02-10 23:01:52adminsetmessages: + msg7191
2023-02-10 23:01:52adminsetstatus: tentatively ready -> ready
2023-02-07 06:06:05adminsetstatus: review -> tentatively ready
2022-11-20 07:54:16adminsetmessages: + msg7045
2022-11-20 07:54:16adminsetstatus: open -> review
2021-10-03 00:00:00admincreate