From Jason Turner

[expr.cond]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp31z3ad9p/{from.md → to.md} +25 -29
tmp/tmp31z3ad9p/{from.md → to.md} RENAMED
@@ -13,19 +13,16 @@ of the second expression, otherwise that of the third expression. Only
13
  one of the second and third expressions is evaluated. Every value
14
  computation and side effect associated with the first expression is
15
  sequenced before every value computation and side effect associated with
16
  the second or third expression.
17
 
18
- If either the second or the third operand has type `void`, then the
19
- lvalue-to-rvalue ([[conv.lval]]), array-to-pointer ([[conv.array]]),
20
- and function-to-pointer ([[conv.func]]) standard conversions are
21
- performed on the second and third operands, and one of the following
22
- shall hold:
23
 
24
- - The second or the third operand (but not both) is a
25
- *throw-expression* ([[except.throw]]); the result is of the type of
26
- the other and is a prvalue.
27
  - Both the second and the third operands have type `void`; the result is
28
  of type `void` and is a prvalue. This includes the case where both
29
  operands are *throw-expression*s.
30
 
31
  Otherwise, if the second and third operand have different types and
@@ -41,11 +38,11 @@ expression `E2` of type `T2` is defined as follows:
41
  reference to `T2`”, subject to the constraint that in the conversion
42
  the reference must bind directly ([[dcl.init.ref]]) to an lvalue.
43
  - If `E2` is an xvalue: `E1` can be converted to match `E2` if `E1` can
44
  be implicitly converted to the type “rvalue reference to `T2`”,
45
  subject to the constraint that the reference must bind directly.
46
- - If `E2` is an rvalue or if neither of the conversions above can be
47
  done and at least one of the operands has (possibly cv-qualified)
48
  class type:
49
  - if `E1` and `E2` have class type, and the underlying class types are
50
  the same or one is a base class of the other: `E1` can be converted
51
  to match `E2` if the class of `T2` is the same type as, or a base
@@ -61,18 +58,18 @@ expression `E2` of type `T2` is defined as follows:
61
  match `E2` if `E1` can be implicitly converted to the type that
62
  expression `E2` would have if `E2` were converted to a prvalue (or
63
  the type it has, if `E2` is a prvalue).
64
 
65
  Using this process, it is determined whether the second operand can be
66
- converted to match the third operand, and whether the third operand
67
- can be converted to match the second operand. If both can be
68
- converted, or one can be converted but the conversion is ambiguous,
69
- the program is ill-formed. If neither can be converted, the operands
70
- are left unchanged and further checking is performed as described
71
- below. If exactly one conversion is possible, that conversion is
72
- applied to the chosen operand and the converted operand is used in
73
- place of the original operand for the remainder of this section.
74
 
75
  If the second and third operands are glvalues of the same value category
76
  and have the same type, the result is of that type and value category
77
  and it is a bit-field if the second or the third operand is a bit-field,
78
  or if both are bit-fields.
@@ -97,19 +94,18 @@ of the following shall hold:
97
  the second operand or the third operand depending on the value of the
98
  first operand.
99
  - The second and third operands have arithmetic or enumeration type; the
100
  usual arithmetic conversions are performed to bring them to a common
101
  type, and the result is of that type.
102
- - The second and third operands have pointer type, or one has pointer
103
- type and the other is a null pointer constant, or both are null
104
- pointer constants, at least one of which is non-integral; pointer
105
- conversions ([[conv.ptr]]) and qualification conversions (
106
  [[conv.qual]]) are performed to bring them to their composite pointer
107
- type ([[expr.rel]]). The result is of the composite pointer type.
108
- - The second and third operands have pointer to member type, or one has
109
- pointer to member type and the other is a null pointer constant;
110
- pointer to member conversions ([[conv.mem]]) and qualification
111
- conversions ([[conv.qual]]) are performed to bring them to a common
112
- type, whose cv-qualification shall match the cv-qualification of
113
- either the second or the third operand. The result is of the common
114
- type.
 
115
 
 
13
  one of the second and third expressions is evaluated. Every value
14
  computation and side effect associated with the first expression is
15
  sequenced before every value computation and side effect associated with
16
  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* ([[except.throw]]); the result is
23
+ of the type and value category of the other.
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 where both
26
  operands are *throw-expression*s.
27
 
28
  Otherwise, if the second and third operand have different types and
 
38
  reference to `T2`”, subject to the constraint that in the conversion
39
  the reference must bind directly ([[dcl.init.ref]]) to an lvalue.
40
  - If `E2` is an xvalue: `E1` can be converted to match `E2` if `E1` can
41
  be implicitly converted to the type “rvalue reference to `T2`”,
42
  subject to the constraint that the reference must bind directly.
43
+ - If `E2` is a prvalue or if neither of the conversions above can be
44
  done and at least one of the operands has (possibly cv-qualified)
45
  class type:
46
  - if `E1` and `E2` have class type, and the underlying class types are
47
  the same or one is a base class of the other: `E1` can be converted
48
  to match `E2` if the class of `T2` is the same type as, or a base
 
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 the second operand can be
63
+ converted to match the third operand, and whether the third operand can
64
+ be converted to match the second operand. If both can be converted, or
65
+ one can be converted but the conversion is ambiguous, the program is
66
+ ill-formed. If neither can be converted, the operands are left unchanged
67
+ and further checking is performed as described below. If exactly one
68
+ conversion is possible, that conversion is applied to the chosen operand
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.
 
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]]) and qualification conversions (
 
 
101
  [[conv.qual]]) are performed to bring them to their composite pointer
102
+ type (Clause  [[expr]]). The result is of the composite pointer type.
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.
108
+ - Both the second and third operands have type `std::nullptr_t` or one
109
+ has that type and the other is a null pointer constant. The result is
110
+ of type `std::nullptr_t`.
111