Created on 2018-02-18.00:00:00 last changed 46 months ago
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:...
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:...
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...”
[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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-12-15 00:00:00 | admin | set | messages: + msg6461 |
2020-12-15 00:00:00 | admin | set | messages: + msg6460 |
2020-12-15 00:00:00 | admin | set | messages: + msg6459 |
2018-02-18 00:00:00 | admin | create |