|
1071 | 1071 | that is not a function template specialization.
|
1072 | 1072 | \end{itemize}
|
1073 | 1073 |
|
| 1074 | +\item |
| 1075 | +The rewritten candidate set is determined as follows: |
| 1076 | +\begin{itemize} |
1074 | 1077 | \item
|
1075 | 1078 | For the relational\iref{expr.rel} operators,
|
1076 | 1079 | the rewritten candidates include
|
1077 | 1080 | all member, non-member, and built-in candidates
|
1078 |
| -for the operator \tcode{<=>} |
1079 |
| -for which the rewritten expression |
1080 |
| -\tcode{(x <=> y) @ 0} is well-formed using that \tcode{operator<=>}. |
| 1081 | +for the expression \tcode{x <=> y}. |
| 1082 | +\item |
1081 | 1083 | For the
|
1082 | 1084 | relational\iref{expr.rel} and
|
1083 | 1085 | three-way comparison\iref{expr.spaceship}
|
|
1086 | 1088 | a synthesized candidate,
|
1087 | 1089 | with the order of the two parameters reversed,
|
1088 | 1090 | for each member, non-member, and built-in candidate
|
1089 |
| -for the operator \tcode{<=>} |
1090 |
| -for which the rewritten expression |
1091 |
| -\tcode{0 @ (y <=> x)} is well-formed using that \tcode{operator<=>}. |
| 1091 | +for the expression |
| 1092 | +\tcode{y <=> x}. |
| 1093 | +\item |
1092 | 1094 | For the \tcode{!=} operator\iref{expr.eq},
|
1093 | 1095 | the rewritten candidates
|
1094 | 1096 | include all member, non-member, and built-in candidates
|
1095 |
| -for the operator \tcode{==} |
1096 |
| -for which the rewritten expression \tcode{(x == y)} is well-formed |
1097 |
| -when contextually converted to \tcode{bool} using that operator \tcode{==}. |
| 1097 | +for the expression \tcode{x == y}. |
| 1098 | +\item |
1098 | 1099 | For the equality operators,
|
1099 | 1100 | the rewritten candidates also include a synthesized candidate,
|
1100 | 1101 | with the order of the two parameters reversed,
|
1101 |
| -for each member, non-member, and built-in candidate for the operator \tcode{==} |
1102 |
| -for which the rewritten expression \tcode{(y == x)} is well-formed |
1103 |
| -when contextually converted to \tcode{bool} using that operator \tcode{==}. |
| 1102 | +for each member, non-member, and built-in candidate |
| 1103 | +for the expression \tcode{y == x}. |
| 1104 | +\item |
| 1105 | +For all other operators, the rewritten candidate set is empty. |
| 1106 | +\end{itemize} |
1104 | 1107 | \begin{note}
|
1105 | 1108 | A candidate synthesized from a member candidate has its implicit
|
1106 | 1109 | object parameter as the second parameter, thus implicit conversions
|
1107 | 1110 | are considered for the first, but not for the second, parameter.
|
1108 | 1111 | \end{note}
|
1109 |
| -In each case, rewritten candidates are not considered |
1110 |
| -in the context of the rewritten expression. |
1111 |
| -For all other operators, the rewritten candidate set is empty. |
1112 | 1112 | \end{itemize}
|
1113 | 1113 |
|
1114 | 1114 | \pnum
|
|
1159 | 1159 | \end{example}
|
1160 | 1160 |
|
1161 | 1161 | \pnum
|
1162 |
| -If a rewritten candidate is selected by overload resolution |
1163 |
| -for a relational or three-way comparison operator \tcode{@}, |
| 1162 | +If a rewritten \tcode{operator<=>} candidate |
| 1163 | +is selected by overload resolution |
| 1164 | +for an operator \tcode{@}, |
1164 | 1165 | \tcode{x @ y}
|
1165 |
| -is interpreted as the rewritten expression: |
| 1166 | +is interpreted as |
1166 | 1167 | \tcode{0 @ (y <=> x)}
|
1167 | 1168 | if the selected candidate is a synthesized candidate
|
1168 | 1169 | with reversed order of parameters,
|
1169 | 1170 | or \tcode{(x <=> y) @ 0} otherwise,
|
1170 | 1171 | using the selected rewritten \tcode{operator<=>} candidate.
|
1171 |
| -If a rewritten candidate is selected by overload resolution |
1172 |
| -for a \tcode{!=} operator, |
1173 |
| -\tcode{x != y} is interpreted as \tcode{(y == x) ?\ false :\ true} |
1174 |
| -if the selected candidate is a synthesized candidate |
1175 |
| -with reversed order of parameters, or |
1176 |
| -\tcode{(x == y) ?\ false :\ true} otherwise, |
1177 |
| -using the selected rewritten \tcode{operator==} candidate. |
1178 |
| -If a rewritten candidate is selected by overload resolution |
1179 |
| -for an \tcode{==} operator, |
1180 |
| -\tcode{x == y} is interpreted as \tcode{(y == x) ?\ true :\ false} |
1181 |
| -using the selected rewritten \tcode{operator==} candidate. |
| 1172 | +Rewritten candidates for the operator \tcode{@} |
| 1173 | +are not considered in the context of the resulting expression. |
| 1174 | + |
| 1175 | +\pnum |
| 1176 | +If a rewritten \tcode{operator==} candidate |
| 1177 | +is selected by overload resolution |
| 1178 | +for an operator \tcode{@}, |
| 1179 | +its return type shall be \cv{} \tcode{bool}, and |
| 1180 | +\tcode{x @ y} is interpreted as: |
| 1181 | +\begin{itemize} |
| 1182 | +\item |
| 1183 | +if \tcode{@} is \tcode{!=} |
| 1184 | +and the selected candidate is a synthesized candidate |
| 1185 | +with reversed order of parameters, |
| 1186 | +\tcode{!(y == x)}, |
| 1187 | +\item |
| 1188 | +otherwise, if \tcode{@} is \tcode{!=}, |
| 1189 | +\tcode{!(x == y)}, |
| 1190 | +\item |
| 1191 | +otherwise (when \tcode{@} is \tcode{==}), |
| 1192 | +\tcode{y == x}, |
| 1193 | +\end{itemize} |
| 1194 | +in each case using the selected rewritten \tcode{operator==} candidate. |
1182 | 1195 |
|
1183 | 1196 | \pnum
|
1184 | 1197 | If a built-in candidate is selected by overload resolution, the
|
|
0 commit comments