Standard does not require any bit representation for bool
, it only requires that there are two values true
and false
- and in particular, it doesn't seem to require that there is only one representation for each value ([basic.fundamental]#10):
Type bool
is a distinct type that has the same object representation, value representation, and alignment requirements as an implementation-defined unsigned integer type.
The values of type bool
are true
and false
.
It is required that true
is mapped to 1
and false
is mapped to 0
when converting bool
to int
([conv.prom]#6):
A prvalue of type bool
can be converted to a prvalue of type int
, with false
becoming zero and true
becoming one.