tmp/tmp43y2j8ko/{from.md → to.md}
RENAMED
|
@@ -17,60 +17,67 @@ the second or third expression.
|
|
| 17 |
|
| 18 |
If either the second or the third operand has type `void`, one of the
|
| 19 |
following shall hold:
|
| 20 |
|
| 21 |
- The second or the third operand (but not both) is a (possibly
|
| 22 |
-
parenthesized) *throw-expression* ([[
|
| 23 |
-
|
|
|
|
| 24 |
- Both the second and the third operands have type `void`; the result is
|
| 25 |
-
of type `void` and is a prvalue. This includes the case
|
| 26 |
-
operands are *throw-expression*s.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
Otherwise, if the second and third operand have different types and
|
| 29 |
either has (possibly cv-qualified) class type, or if both are glvalues
|
| 30 |
of the same value category and the same type except for
|
| 31 |
-
cv-qualification, an attempt is made to
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
expression `E2` of type `T2` is defined as follows:
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
subject to the constraint that the reference must bind directly.
|
| 43 |
-
- If `E2` is a prvalue or if neither of the
|
| 44 |
-
|
| 45 |
-
class type:
|
| 46 |
-
- if `
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
of type `T2` from `E1` and using that temporary as the converted
|
| 54 |
-
operand.
|
| 55 |
-
- Otherwise (i.e., if `E1` or `E2` has a nonclass type, or if they
|
| 56 |
-
both have class types but the underlying classes are not either the
|
| 57 |
-
same or one a base class of the other): `E1` can be converted to
|
| 58 |
-
match `E2` if `E1` can be implicitly converted to the type that
|
| 59 |
-
expression `E2` would have if `E2` were converted to a prvalue (or
|
| 60 |
-
the type it has, if `E2` is a prvalue).
|
| 61 |
|
| 62 |
-
Using this process, it is determined whether
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
one can be
|
| 66 |
-
ill-formed. If
|
| 67 |
-
|
| 68 |
-
|
|
|
|
| 69 |
and the converted operand is used in place of the original operand for
|
| 70 |
the remainder of this section.
|
| 71 |
|
|
|
|
|
|
|
|
|
|
| 72 |
If the second and third operands are glvalues of the same value category
|
| 73 |
and have the same type, the result is of that type and value category
|
| 74 |
and it is a bit-field if the second or the third operand is a bit-field,
|
| 75 |
or if both are bit-fields.
|
| 76 |
|
|
@@ -87,21 +94,20 @@ Lvalue-to-rvalue ([[conv.lval]]), array-to-pointer ([[conv.array]]),
|
|
| 87 |
and function-to-pointer ([[conv.func]]) standard conversions are
|
| 88 |
performed on the second and third operands. After those conversions, one
|
| 89 |
of the following shall hold:
|
| 90 |
|
| 91 |
- The second and third operands have the same type; the result is of
|
| 92 |
-
that type
|
| 93 |
-
|
| 94 |
-
the second operand or the third operand depending on the value of the
|
| 95 |
-
first operand.
|
| 96 |
- The second and third operands have arithmetic or enumeration type; the
|
| 97 |
usual arithmetic conversions are performed to bring them to a common
|
| 98 |
type, and the result is of that type.
|
| 99 |
- One or both of the second and third operands have pointer type;
|
| 100 |
-
pointer conversions ([[conv.ptr]])
|
| 101 |
-
[[conv.
|
| 102 |
-
|
|
|
|
| 103 |
- One or both of the second and third operands have pointer to member
|
| 104 |
type; pointer to member conversions ([[conv.mem]]) and qualification
|
| 105 |
conversions ([[conv.qual]]) are performed to bring them to their
|
| 106 |
composite pointer type (Clause [[expr]]). The result is of the
|
| 107 |
composite pointer type.
|
|
|
|
| 17 |
|
| 18 |
If either the second or the third operand has type `void`, one of the
|
| 19 |
following shall hold:
|
| 20 |
|
| 21 |
- The second or the third operand (but not both) is a (possibly
|
| 22 |
+
parenthesized) *throw-expression* ([[expr.throw]]); the result is of
|
| 23 |
+
the type and value category of the other. The *conditional-expression*
|
| 24 |
+
is a bit-field if that operand is a bit-field.
|
| 25 |
- Both the second and the third operands have type `void`; the result is
|
| 26 |
+
of type `void` and is a prvalue. \[*Note 1*: This includes the case
|
| 27 |
+
where both operands are *throw-expression*s. — *end note*]
|
| 28 |
+
|
| 29 |
+
Otherwise, if the second and third operand are glvalue bit-fields of the
|
| 30 |
+
same value category and of types *cv1* `T` and *cv2* `T`, respectively,
|
| 31 |
+
the operands are considered to be of type *cv* `T` for the remainder of
|
| 32 |
+
this section, where *cv* is the union of *cv1* and *cv2*.
|
| 33 |
|
| 34 |
Otherwise, if the second and third operand have different types and
|
| 35 |
either has (possibly cv-qualified) class type, or if both are glvalues
|
| 36 |
of the same value category and the same type except for
|
| 37 |
+
cv-qualification, an attempt is made to form an implicit conversion
|
| 38 |
+
sequence ([[over.best.ics]]) from each of those operands to the type of
|
| 39 |
+
the other.
|
|
|
|
| 40 |
|
| 41 |
+
[*Note 2*: Properties such as access, whether an operand is a
|
| 42 |
+
bit-field, or whether a conversion function is deleted are ignored for
|
| 43 |
+
that determination. — *end note*]
|
| 44 |
+
|
| 45 |
+
Attempts are made to form an implicit conversion sequence from an
|
| 46 |
+
operand expression `E1` of type `T1` to a target type related to the
|
| 47 |
+
type `T2` of the operand expression `E2` as follows:
|
| 48 |
+
|
| 49 |
+
- If `E2` is an lvalue, the target type is “lvalue reference to `T2`”,
|
| 50 |
+
subject to the constraint that in the conversion the reference must
|
| 51 |
+
bind directly ([[dcl.init.ref]]) to an lvalue.
|
| 52 |
+
- If `E2` is an xvalue, the target type is “rvalue reference to `T2`”,
|
| 53 |
subject to the constraint that the reference must bind directly.
|
| 54 |
+
- If `E2` is a prvalue or if neither of the conversion sequences above
|
| 55 |
+
can be formed and at least one of the operands has (possibly
|
| 56 |
+
cv-qualified) class type:
|
| 57 |
+
- if `T1` and `T2` are the same class type (ignoring
|
| 58 |
+
cv-qualification), or one is a base class of the other, and `T2` is
|
| 59 |
+
at least as cv-qualified as `T1`, the target type is `T2`,
|
| 60 |
+
- otherwise, the target type is the type that `E2` would have after
|
| 61 |
+
applying the lvalue-to-rvalue ([[conv.lval]]), array-to-pointer (
|
| 62 |
+
[[conv.array]]), and function-to-pointer ([[conv.func]]) standard
|
| 63 |
+
conversions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
+
Using this process, it is determined whether an implicit conversion
|
| 66 |
+
sequence can be formed from the second operand to the target type
|
| 67 |
+
determined for the third operand, and vice versa. If both sequences can
|
| 68 |
+
be formed, or one can be formed but it is the ambiguous conversion
|
| 69 |
+
sequence, the program is ill-formed. If no conversion sequence can be
|
| 70 |
+
formed, the operands are left unchanged and further checking is
|
| 71 |
+
performed as described below. Otherwise, if exactly one conversion
|
| 72 |
+
sequence can be formed, that conversion is applied to the chosen operand
|
| 73 |
and the converted operand is used in place of the original operand for
|
| 74 |
the remainder of this section.
|
| 75 |
|
| 76 |
+
[*Note 3*: The conversion might be ill-formed even if an implicit
|
| 77 |
+
conversion sequence could be formed. — *end note*]
|
| 78 |
+
|
| 79 |
If the second and third operands are glvalues of the same value category
|
| 80 |
and have the same type, the result is of that type and value category
|
| 81 |
and it is a bit-field if the second or the third operand is a bit-field,
|
| 82 |
or if both are bit-fields.
|
| 83 |
|
|
|
|
| 94 |
and function-to-pointer ([[conv.func]]) standard conversions are
|
| 95 |
performed on the second and third operands. After those conversions, one
|
| 96 |
of the following shall hold:
|
| 97 |
|
| 98 |
- The second and third operands have the same type; the result is of
|
| 99 |
+
that type and the result object is initialized using the selected
|
| 100 |
+
operand.
|
|
|
|
|
|
|
| 101 |
- The second and third operands have arithmetic or enumeration type; the
|
| 102 |
usual arithmetic conversions are performed to bring them to a common
|
| 103 |
type, and the result is of that type.
|
| 104 |
- One or both of the second and third operands have pointer type;
|
| 105 |
+
pointer conversions ([[conv.ptr]]), function pointer conversions (
|
| 106 |
+
[[conv.fctptr]]), and qualification conversions ([[conv.qual]]) are
|
| 107 |
+
performed to bring them to their composite pointer type (Clause
|
| 108 |
+
[[expr]]). The result is of the composite pointer type.
|
| 109 |
- One or both of the second and third operands have pointer to member
|
| 110 |
type; pointer to member conversions ([[conv.mem]]) and qualification
|
| 111 |
conversions ([[conv.qual]]) are performed to bring them to their
|
| 112 |
composite pointer type (Clause [[expr]]). The result is of the
|
| 113 |
composite pointer type.
|