tmp/tmpma3wdnsj/{from.md → to.md}
RENAMED
|
@@ -1,21 +1,17 @@
|
|
| 1 |
### Integral promotions <a id="conv.prom">[[conv.prom]]</a>
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
if `int` can represent all the values of the source type; otherwise, the
|
| 7 |
-
source prvalue can be converted to a prvalue of type `unsigned int`.
|
| 8 |
|
| 9 |
-
A prvalue
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
type
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
of type `char8_t`, `char16_t`, `char32_t`, or `wchar_t` can be converted
|
| 16 |
-
to a prvalue of its underlying type.
|
| 17 |
|
| 18 |
A prvalue of an unscoped enumeration type whose underlying type is not
|
| 19 |
fixed can be converted to a prvalue of the first of the following types
|
| 20 |
that can represent all the values of the enumeration [[dcl.enum]]:
|
| 21 |
`int`, `unsigned int`, `long int`, `unsigned long int`, `long long int`,
|
|
@@ -31,17 +27,25 @@ A prvalue of an unscoped enumeration type whose underlying type is fixed
|
|
| 31 |
[[dcl.enum]] can be converted to a prvalue of its underlying type.
|
| 32 |
Moreover, if integral promotion can be applied to its underlying type, a
|
| 33 |
prvalue of an unscoped enumeration type whose underlying type is fixed
|
| 34 |
can also be converted to a prvalue of the promoted underlying type.
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
A prvalue of type `bool` can be converted to a prvalue of type `int`,
|
| 45 |
with `false` becoming zero and `true` becoming one.
|
| 46 |
|
| 47 |
These conversions are called *integral promotions*.
|
|
|
|
| 1 |
### Integral promotions <a id="conv.prom">[[conv.prom]]</a>
|
| 2 |
|
| 3 |
+
For the purposes of [[conv.prom]], a *converted bit-field* is a prvalue
|
| 4 |
+
that is the result of an lvalue-to-rvalue conversion [[conv.lval]]
|
| 5 |
+
applied to a bit-field [[class.bit]].
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
A prvalue that is not a converted bit-field and has an integer type
|
| 8 |
+
other than `bool`, `char8_t`, `char16_t`, `char32_t`, or `wchar_t` whose
|
| 9 |
+
integer conversion rank [[conv.rank]] is less than the rank of `int` can
|
| 10 |
+
be converted to a prvalue of type `int` if `int` can represent all the
|
| 11 |
+
values of the source type; otherwise, the source prvalue can be
|
| 12 |
+
converted to a prvalue of type `unsigned int`.
|
|
|
|
|
|
|
| 13 |
|
| 14 |
A prvalue of an unscoped enumeration type whose underlying type is not
|
| 15 |
fixed can be converted to a prvalue of the first of the following types
|
| 16 |
that can represent all the values of the enumeration [[dcl.enum]]:
|
| 17 |
`int`, `unsigned int`, `long int`, `unsigned long int`, `long long int`,
|
|
|
|
| 27 |
[[dcl.enum]] can be converted to a prvalue of its underlying type.
|
| 28 |
Moreover, if integral promotion can be applied to its underlying type, a
|
| 29 |
prvalue of an unscoped enumeration type whose underlying type is fixed
|
| 30 |
can also be converted to a prvalue of the promoted underlying type.
|
| 31 |
|
| 32 |
+
[*Note 1*: A converted bit-field of enumeration type is treated as any
|
| 33 |
+
other value of that type for promotion purposes. — *end note*]
|
| 34 |
+
|
| 35 |
+
A converted bit-field of integral type can be converted to a prvalue of
|
| 36 |
+
type `int` if `int` can represent all the values of the bit-field;
|
| 37 |
+
otherwise, it can be converted to `unsigned int` if `unsigned int` can
|
| 38 |
+
represent all the values of the bit-field.
|
| 39 |
+
|
| 40 |
+
A prvalue of type `char8_t`, `char16_t`, `char32_t`, or `wchar_t`
|
| 41 |
+
[[basic.fundamental]] (including a converted bit-field that was not
|
| 42 |
+
already promoted to `int` or `unsigned int` according to the rules
|
| 43 |
+
above) can be converted to a prvalue of the first of the following types
|
| 44 |
+
that can represent all the values of its underlying type: `int`,
|
| 45 |
+
`unsigned int`, `long int`, `unsigned long int`, `long long int`,
|
| 46 |
+
`unsigned long long int`, or its underlying type.
|
| 47 |
|
| 48 |
A prvalue of type `bool` can be converted to a prvalue of type `int`,
|
| 49 |
with `false` becoming zero and `true` becoming one.
|
| 50 |
|
| 51 |
These conversions are called *integral promotions*.
|