This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 120c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2026-09-04


3225. Conversion of bool to signed integer of width 1

Section: 7.3.9  [conv.integral]     Status: tentatively ready     Submitter: Janet Cobb     Date: 2023-07-15

(From submission #365.)

According to 6.9.3 [basic.fundamental] paragraph 1, a signed integer of width 1 can represent the values -1 and 0. It is unclear how the boolean-to-integer conversion (7.3.9 [conv.integral]) works for such a situation.

Proposed resolution (approved by CWG 2026-09-01):

Change in 7.3.9 [conv.integral] paragraph 2 and paragraph 3 as follows:

If the destination type is bool, see 7.3.15 [conv.bool]. If the source type is bool, the value false is converted to zero and the value true is converted to one source integer value is considered to be zero if the value is false and one otherwise.

Otherwise, the The result is the unique value of the destination type that is congruent to the source integer value modulo 2^N, where N is the width of the destination type.