This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110c. See for the official list.


1320. Converting scoped enumerations to bool

Section:  [expr.static.cast]     Status: CD3     Submitter: Jonathan Wakely     Date: 2011-05-18

[Moved to DR at the April, 2013 meeting.]

The specification of static_cast ( [expr.static.cast]) does not describe conversion of a scoped enumeration value to bool. Presumably it should be handled as for unscoped enumerations, with a zero value becoming false and a non-zero value becoming true.

Proposed resolution (August, 2012):

Change [expr.static.cast] paragraph 9 as follows:

A value of a scoped enumeration type (9.7.1 [dcl.enum]) can be explicitly converted to an integral type. The When that type is cv bool, the resulting value is false if the original value is zero and true for all other values. For the remaining integral types, the value is unchanged if the original value can be represented by the specified type. Otherwise, the resulting value is unspecified.