|
975 | 975 | \tcode{T1}
|
976 | 976 | and a right operand of a type whose cv-unqualified version is
|
977 | 977 | \tcode{T2},
|
978 |
| -three sets of candidate functions, designated |
| 978 | +four sets of candidate functions, designated |
979 | 979 | \defnx{member candidates}{member candidate},
|
980 |
| -\defnx{non-member candidates}{non-member candidate} |
981 |
| -and \defnx{built-in candidates}{built-in candidate}, |
| 980 | +\defnx{non-member candidates}{non-member candidate}, |
| 981 | +\defnx{built-in candidates}{built-in candidate}, |
| 982 | +and |
| 983 | +\defnx{rewritten candidates}{rewritten candidate}, |
982 | 984 | are constructed as follows:
|
983 | 985 | \begin{itemize}
|
984 | 986 | \item
|
|
1033 | 1035 | do not have the same parameter-type-list as any non-member candidate
|
1034 | 1036 | that is not a function template specialization.
|
1035 | 1037 | \end{itemize}
|
| 1038 | + |
| 1039 | +\item |
| 1040 | +For the |
| 1041 | +relational\iref{expr.rel} and |
| 1042 | +equality\iref{expr.eq} operators, |
| 1043 | +the rewritten candidates include |
| 1044 | +all member, non-member, and built-in candidates |
| 1045 | +for the operator \tcode{<=>} |
| 1046 | +for which the rewritten expression |
| 1047 | +\tcode{(x <=> y) @ 0} is well-formed using that \tcode{operator<=>}. |
| 1048 | +For the |
| 1049 | +relational\iref{expr.rel}, |
| 1050 | +equality\iref{expr.eq}, |
| 1051 | +and |
| 1052 | +three-way comparison\iref{expr.spaceship} |
| 1053 | +operators, |
| 1054 | +the rewritten candidates also include |
| 1055 | +a synthesized candidate, |
| 1056 | +with the order of the two parameters reversed, |
| 1057 | +for each member, non-member, and built-in candidate |
| 1058 | +for the operator \tcode{<=>} |
| 1059 | +for which the rewritten expression |
| 1060 | +\tcode{0 @ (y <=> x)} is well-formed using that \tcode{operator<=>}. |
| 1061 | +\begin{note} |
| 1062 | +A candidate synthesized from a member candidate has its implicit |
| 1063 | +object parameter as the second parameter, thus implicit conversions |
| 1064 | +are considered for the first, but not for the second, parameter. |
| 1065 | +\end{note} |
| 1066 | +In each case, rewritten candidates are not considered |
| 1067 | +in the context of the rewritten expression. |
| 1068 | +For all other operators, the rewritten candidate set is empty. |
1036 | 1069 | \end{itemize}
|
1037 | 1070 |
|
1038 | 1071 | \pnum
|
|
1054 | 1087 | The set of candidate functions for overload resolution
|
1055 | 1088 | for some operator \tcode{@}
|
1056 | 1089 | is the
|
1057 |
| -union of the member candidates, the non-member candidates, and |
1058 |
| -the built-in candidates for that operator \tcode{@}. |
1059 |
| -If that operator is a |
1060 |
| -relational\iref{expr.rel}, |
1061 |
| -equality\iref{expr.eq}, |
1062 |
| -or three-way comparison\iref{expr.spaceship} |
1063 |
| -operator |
1064 |
| -with operands \tcode{x} and \tcode{y}, |
1065 |
| -then for each member, non-member, or built-in candidate |
1066 |
| -for the operator \tcode{<=>}: |
1067 |
| -\begin{itemize} |
1068 |
| -\item |
1069 |
| -that operator is added to the set of candidate functions for overload resolution |
1070 |
| -if \tcode{@} is not \tcode{<=>} |
1071 |
| -and \tcode{(x <=> y) @ 0} is well-formed using that \tcode{operator<=>}; and |
1072 |
| -\item |
1073 |
| -a synthesized candidate is added to the candidate set |
1074 |
| -where the order of the two parameters is reversed |
1075 |
| -if \tcode{0 @ (y <=> x)} is well-formed using that \tcode{operator<=>}; |
1076 |
| -\end{itemize} |
1077 |
| -where in each case, |
1078 |
| -\begin{itemize} |
1079 |
| -\item if \tcode{@} is not \tcode{<=>}, |
1080 |
| -\tcode{operator<=>} candidates |
1081 |
| -are not considered for the recursive lookup of operator \tcode{@} |
1082 |
| -and |
1083 |
| -\item |
1084 |
| -synthesized \tcode{operator<=>} candidates |
1085 |
| -are not considered for the recursive lookups. |
1086 |
| -\end{itemize} |
1087 |
| -\begin{note} |
1088 |
| -A candidate synthesized from a member candidate has its implicit |
1089 |
| -object parameter as the second parameter, thus implicit conversions |
1090 |
| -are considered for the first, but not for the second, parameter. |
1091 |
| -\end{note} |
| 1090 | +union of |
| 1091 | +the member candidates, |
| 1092 | +the non-member candidates, |
| 1093 | +the built-in candidates, |
| 1094 | +and the rewritten candidates |
| 1095 | +for that operator \tcode{@}. |
1092 | 1096 |
|
1093 | 1097 | \pnum
|
1094 | 1098 | The argument list contains all of the
|
|
1112 | 1116 | \end{example}
|
1113 | 1117 |
|
1114 | 1118 | \pnum
|
1115 |
| -If an \tcode{operator<=>} candidate |
| 1119 | +If a rewritten candidate |
1116 | 1120 | is selected by overload resolution for an operator \tcode{@},
|
1117 | 1121 | \tcode{x @ y}
|
1118 |
| -is interpreted as \tcode{0 @ (y <=> x)} |
| 1122 | +is interpreted as the rewritten expression: |
| 1123 | +\tcode{0 @ (y <=> x)} |
1119 | 1124 | if the selected candidate is a synthesized candidate
|
1120 | 1125 | with reversed order of parameters,
|
1121 |
| -or \tcode{(x <=> y) @ 0} if \tcode{@} is not \tcode{<=>}, |
1122 |
| -using the selected \tcode{operator<=>} candidate. |
| 1126 | +or \tcode{(x <=> y) @ 0} otherwise, |
| 1127 | +using the selected rewritten \tcode{operator<=>} candidate. |
1123 | 1128 |
|
1124 | 1129 | \pnum
|
1125 | 1130 | If a built-in candidate is selected by overload resolution, the
|
|
0 commit comments