tmp/tmpypppe65v/{from.md → to.md}
RENAMED
|
@@ -1,109 +1,35 @@
|
|
| 1 |
-
## Integer conversion rank <a id="conv.rank">[[conv.rank]]</a>
|
| 2 |
|
| 3 |
Every integer type has an *integer conversion rank* defined as follows:
|
| 4 |
|
| 5 |
- No two signed integer types other than `char` and `signed
|
| 6 |
char` (if `char` is signed) shall have the same rank, even if they
|
| 7 |
have the same representation.
|
| 8 |
- The rank of a signed integer type shall be greater than the rank of
|
| 9 |
-
any signed integer type with a smaller
|
| 10 |
- The rank of `long long int` shall be greater than the rank of
|
| 11 |
`long int`, which shall be greater than the rank of `int`, which shall
|
| 12 |
be greater than the rank of `short int`, which shall be greater than
|
| 13 |
the rank of `signed char`.
|
| 14 |
- The rank of any unsigned integer type shall equal the rank of the
|
| 15 |
corresponding signed integer type.
|
| 16 |
- The rank of any standard integer type shall be greater than the rank
|
| 17 |
-
of any extended integer type with the same
|
| 18 |
- The rank of `char` shall equal the rank of `signed char` and
|
| 19 |
`unsigned char`.
|
| 20 |
- The rank of `bool` shall be less than the rank of all other standard
|
| 21 |
integer types.
|
| 22 |
-
- The ranks of `char16_t`, `char32_t`, and `wchar_t` shall
|
| 23 |
-
ranks of their underlying types
|
| 24 |
- The rank of any extended signed integer type relative to another
|
| 25 |
-
extended signed integer type with the same
|
| 26 |
*implementation-defined*, but still subject to the other rules for
|
| 27 |
determining the integer conversion rank.
|
| 28 |
- For all integer types `T1`, `T2`, and `T3`, if `T1` has greater rank
|
| 29 |
than `T2` and `T2` has greater rank than `T3`, then `T1` shall have
|
| 30 |
greater rank than `T3`.
|
| 31 |
|
| 32 |
[*Note 1*: The integer conversion rank is used in the definition of the
|
| 33 |
-
integral promotions
|
| 34 |
-
|
| 35 |
|
| 36 |
-
<!-- Link reference definitions -->
|
| 37 |
-
[basic.compound]: basic.md#basic.compound
|
| 38 |
-
[basic.def.odr]: basic.md#basic.def.odr
|
| 39 |
-
[basic.fundamental]: basic.md#basic.fundamental
|
| 40 |
-
[basic.lval]: basic.md#basic.lval
|
| 41 |
-
[basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
|
| 42 |
-
[basic.stc.dynamic.safety]: basic.md#basic.stc.dynamic.safety
|
| 43 |
-
[basic.type.qualifier]: basic.md#basic.type.qualifier
|
| 44 |
-
[class.access]: class.md#class.access
|
| 45 |
-
[class.bit]: class.md#class.bit
|
| 46 |
-
[class.conv]: special.md#class.conv
|
| 47 |
-
[class.derived]: class.md#class.derived
|
| 48 |
-
[class.dtor]: special.md#class.dtor
|
| 49 |
-
[class.member.lookup]: class.md#class.member.lookup
|
| 50 |
-
[class.mi]: class.md#class.mi
|
| 51 |
-
[class.temporary]: special.md#class.temporary
|
| 52 |
-
[class.union]: class.md#class.union
|
| 53 |
-
[conv]: #conv
|
| 54 |
-
[conv.array]: #conv.array
|
| 55 |
-
[conv.bool]: #conv.bool
|
| 56 |
-
[conv.double]: #conv.double
|
| 57 |
-
[conv.fctptr]: #conv.fctptr
|
| 58 |
-
[conv.fpint]: #conv.fpint
|
| 59 |
-
[conv.fpprom]: #conv.fpprom
|
| 60 |
-
[conv.func]: #conv.func
|
| 61 |
-
[conv.integral]: #conv.integral
|
| 62 |
-
[conv.lval]: #conv.lval
|
| 63 |
-
[conv.mem]: #conv.mem
|
| 64 |
-
[conv.prom]: #conv.prom
|
| 65 |
-
[conv.ptr]: #conv.ptr
|
| 66 |
-
[conv.qual]: #conv.qual
|
| 67 |
-
[conv.rank]: #conv.rank
|
| 68 |
-
[conv.rval]: #conv.rval
|
| 69 |
-
[dcl.array]: dcl.md#dcl.array
|
| 70 |
-
[dcl.enum]: dcl.md#dcl.enum
|
| 71 |
-
[dcl.fct]: dcl.md#dcl.fct
|
| 72 |
-
[dcl.init]: dcl.md#dcl.init
|
| 73 |
-
[dcl.init.ref]: dcl.md#dcl.init.ref
|
| 74 |
-
[dcl.mptr]: dcl.md#dcl.mptr
|
| 75 |
-
[dcl.ptr]: dcl.md#dcl.ptr
|
| 76 |
-
[dcl.ref]: dcl.md#dcl.ref
|
| 77 |
-
[expr]: expr.md#expr
|
| 78 |
-
[intro.execution]: intro.md#intro.execution
|
| 79 |
-
[lex.icon]: lex.md#lex.icon
|
| 80 |
-
[over.best.ics]: over.md#over.best.ics
|
| 81 |
-
[over.over]: over.md#over.over
|
| 82 |
-
[stmt.iter]: stmt.md#stmt.iter
|
| 83 |
-
[stmt.select]: stmt.md#stmt.select
|
| 84 |
-
|
| 85 |
-
[^1]: For historical reasons, this conversion is called the
|
| 86 |
-
“lvalue-to-rvalue” conversion, even though that name does not
|
| 87 |
-
accurately reflect the taxonomy of expressions described in
|
| 88 |
-
[[basic.lval]].
|
| 89 |
-
|
| 90 |
-
[^2]: In C++class and array prvalues can have cv-qualified types. This
|
| 91 |
-
differs from ISO C, in which non-lvalues never have cv-qualified
|
| 92 |
-
types.
|
| 93 |
-
|
| 94 |
-
[^3]: This conversion never applies to non-static member functions
|
| 95 |
-
because an lvalue that refers to a non-static member function cannot
|
| 96 |
-
be obtained.
|
| 97 |
-
|
| 98 |
-
[^4]: These rules ensure that const-safety is preserved by the
|
| 99 |
-
conversion.
|
| 100 |
-
|
| 101 |
-
[^5]: The rule for conversion of pointers to members (from pointer to
|
| 102 |
-
member of base to pointer to member of derived) appears inverted
|
| 103 |
-
compared to the rule for pointers to objects (from pointer to
|
| 104 |
-
derived to pointer to base) ([[conv.ptr]], Clause
|
| 105 |
-
[[class.derived]]). This inversion is necessary to ensure type
|
| 106 |
-
safety. Note that a pointer to member is not an object pointer or a
|
| 107 |
-
function pointer and the rules for conversions of such pointers do
|
| 108 |
-
not apply to pointers to members. In particular, a pointer to member
|
| 109 |
-
cannot be converted to a `void*`.
|
|
|
|
| 1 |
+
### Integer conversion rank <a id="conv.rank">[[conv.rank]]</a>
|
| 2 |
|
| 3 |
Every integer type has an *integer conversion rank* defined as follows:
|
| 4 |
|
| 5 |
- No two signed integer types other than `char` and `signed
|
| 6 |
char` (if `char` is signed) shall have the same rank, even if they
|
| 7 |
have the same representation.
|
| 8 |
- The rank of a signed integer type shall be greater than the rank of
|
| 9 |
+
any signed integer type with a smaller width.
|
| 10 |
- The rank of `long long int` shall be greater than the rank of
|
| 11 |
`long int`, which shall be greater than the rank of `int`, which shall
|
| 12 |
be greater than the rank of `short int`, which shall be greater than
|
| 13 |
the rank of `signed char`.
|
| 14 |
- The rank of any unsigned integer type shall equal the rank of the
|
| 15 |
corresponding signed integer type.
|
| 16 |
- The rank of any standard integer type shall be greater than the rank
|
| 17 |
+
of any extended integer type with the same width.
|
| 18 |
- The rank of `char` shall equal the rank of `signed char` and
|
| 19 |
`unsigned char`.
|
| 20 |
- The rank of `bool` shall be less than the rank of all other standard
|
| 21 |
integer types.
|
| 22 |
+
- The ranks of `char8_t`, `char16_t`, `char32_t`, and `wchar_t` shall
|
| 23 |
+
equal the ranks of their underlying types [[basic.fundamental]].
|
| 24 |
- The rank of any extended signed integer type relative to another
|
| 25 |
+
extended signed integer type with the same width is
|
| 26 |
*implementation-defined*, but still subject to the other rules for
|
| 27 |
determining the integer conversion rank.
|
| 28 |
- For all integer types `T1`, `T2`, and `T3`, if `T1` has greater rank
|
| 29 |
than `T2` and `T2` has greater rank than `T3`, then `T1` shall have
|
| 30 |
greater rank than `T3`.
|
| 31 |
|
| 32 |
[*Note 1*: The integer conversion rank is used in the definition of the
|
| 33 |
+
integral promotions [[conv.prom]] and the usual arithmetic conversions
|
| 34 |
+
[[expr.arith.conv]]. — *end note*]
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|