Title
Scoped enumeration in a switch statement
Status
c++14
Section
8.5.3 [stmt.switch]
Submitter
Canada

Created on 2013-09-23.00:00:00 last changed 121 months ago

Messages

Date: 2014-02-15.00:00:00

[Moved to DR at the February, 2014 meeting.]

Date: 2013-09-15.00:00:00

Proposed resolution (September, 2013):

Change 8.5.3 [stmt.switch] paragraph 2 as follows:

The condition shall be of integral type, enumeration type, or class type. If of class type, the condition is contextually implicitly converted (7.3 [conv]) to an integral or enumeration type. Integral promotions are performed. If the (possibly converted) type is subject to integral promotions (7.3.7 [conv.prom]), the condition is converted to the promoted type. Any statement within the switch statement can be labeled with one or more case labels as follows:

    case constant-expression :

where the constant-expression shall be a converted constant expression (7.7 [expr.const]) of the promoted adjusted type of the switch condition. No two of the case constants in the same switch shall have the same value after conversion to the promoted type of the switch condition.

Date: 2013-09-23.00:00:00
N3690 comment CA 8

The description of the switch statement and case labels in 8.5.3 [stmt.switch] paragraph 2 apply integral promotions to the condition value and refer to the “promoted type” of the condition. However, the integral promotions (7.3.7 [conv.prom]) do not describe the result when they are applied to a scoped enumeration value.

History
Date User Action Args
2014-11-24 00:00:00adminsetstatus: dr -> c++14
2014-03-03 00:00:00adminsetmessages: + msg4946
2014-03-03 00:00:00adminsetstatus: ready -> dr
2013-10-14 00:00:00adminsetmessages: + msg4584
2013-09-23 00:00:00admincreate