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