New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The structure of the rule of producing a transformed template when partial ordering #4547
Comments
@jensmaurer Could you please have a look? |
For the first issue, I think the lookup rules prevent non-member functions and member functions from appearing in the same overload set. (If class member lookup found something, we don't go looking for non-member functions.) The second issue does not feel editorial to me. |
Why would be that? The example that follows [temp.func.order#3] exactly indicates the case where the overload set may comprise non-member functions and member functions. struct A { };
template<class T> struct B {
template<class R> int operator*(R&); // #1
};
template<class T, class R> int operator*(T&, R&); // #2
A a;
B<A> b;
b * a; //#3 The invocation at
Appears after the introduction sentence
The above issue has discussed at https://stackoverflow.com/a/65206517/11796722 |
In order to determine which of the two function templates is more specialized, partial ordering is used to select the best candidate; This process needs a pair of type(The deduction process uses the transformed type as the argument template and the original type of the other template as the parameter template.)
The relevant rule is written in temp.func.order#3
The first issue is:
This structure of the rule looks like adding an extra implicit object parameter to the function parameter list is a part of producing the transformed template. In other words, the original type of the member function does not have the implicit object parameter. That would make two candidates functions in which one is a member function template to be non-comparable? Because the transformed template of the non-member function does not have the same number of parameters as the original template of the member function template. Is it necessary to take the rule which describes that the parameter list of a member function template has an extra parameter out to make it to be an individual rule? And that rule will precede the rule of producing a transformed template.
The second issue is:
For this rule, Isn't the rule a bit misleading? Presumably, it says that the synthesized candidate is used to participate in the partial ordering. However, the synthesized candidate is in the overload set instead of the original function template which is rewritten by reversing the order of parameters. I mean the viable function template is not the original function template, so it does not be considered by overload resolution. Reversing the order of parameters of a synthesized function template does not make sense.
The text was updated successfully, but these errors were encountered: