4.5
A prvalue of an integer type [...] whose integer conversion rank (4.13) is less than the rank of int can be converted to a prvalue of type int [...].
A prvalue of an unscoped enumeration type whose underlying type is fixed (7.2) can be converted to a prvalue of its underlying type. Moreover, if integral promotion can be applied to its underlying type, a prvalue of an unscoped enumeration type whose underlying type is fixed can also be converted to a prvalue of the promoted underlying type.
4.7
[...] A prvalue of an unscoped enumeration type can be converted to a prvalue of an integer type.
The conversions allowed as integral promotions are excluded from the set of integral conversions.
4.13
— The rank of a signed integer type shall be greater than the rank of any signed integer type with a smaller size.
— The rank of long long int shall be greater than the rank of long int, which shall be greater than the rank of int, which shall be greater than the rank of short int, which shall be greater than the rank of signed char.
13.3.3.2
Standard conversion sequences are ordered by their ranks: an Exact Match is a better conversion than a Promotion, which is a better conversion than a Conversion. Two conversion sequences with the same rank are indistinguishable unless one of the following rules applies:
[...]
— conversion of C to B is better than conversion of C to A,
Partager