This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Adopted as a DR at the November, 2019 meeting.]
According to 9.4.5 [dcl.init.list] bullet 3.8,
Otherwise, if T is an enumeration with a fixed underlying type (9.7.1 [dcl.enum]), the initializer-list has a single element v, and the initialization is direct-list-initialization, the object is initialized with the value T(v) (7.6.1.4 [expr.type.conv]); if a narrowing conversion is required to convert v to the underlying type of T, the program is ill-formed.
The conversion T(v) is too broad, allowing, e.g., conversion from a different scoped enumeration type. The intent presumably was only to allow v to be a value of T's underlying type.
Notes from the October, 2018 teleconference:
CWG agreed with the suggested direction, along the lines of “...can be implicitly converted to the underlying type of T...”
Proposed resolution (May, 2019): [SUPERSEDED]
Change bullet 3.8 of 9.4.5 [dcl.init.list] as follows:
Otherwise, if T is an enumeration with a fixed underlying type (9.7.1 [dcl.enum]), the initializer-list has a single element v, v can be implicitly converted to the underlying type of T, and the initialization is direct-list-initialization, the object is initialized with the value T(v) (7.6.1.4 [expr.type.conv]); if a narrowing conversion is required to convert v to the underlying type of T, the program is ill-formed. [Example:...
Proposed resolution (October, 2019):
Change bullet 3.8 of 9.4.5 [dcl.init.list] as follows:
Otherwise, if T is an enumeration with a fixed
underlying type
(9.7.1 [dcl.enum]) U,
the initializer-list has a single
element v, v can be implicitly
converted to U, and the initialization is
direct-list-initialization, the object is initialized with
the value T(v) (7.6.1.4 [expr.type.conv]); if a
narrowing conversion is required to convert v to
the underlying type of T
U, the program is
ill-formed. [Example:...