Created on 2018-02-14.00:00:00 last changed 48 months ago
Proposed resolution (October, 2018):
Change 13.7.7.3 [temp.func.order] paragraph 3 as follows:
...If only one of the function templates M is a member function, and that function is a non-static member of some class A, M is considered to have a new first parameter inserted in its function parameter list. Given cv as the cv-qualifiers of M (if any), the new parameter is of type “rvalue reference to cv A” if the optional ref-qualifier of M is && or if M has no ref-qualifier and the first parameter of the other template has rvalue reference type. Otherwise, the new parameter is of type “lvalue reference to cv A”. [Note: This allows a non-static member to be ordered with respect to a non-member function and for the results to be equivalent to the ordering of two equivalent non-members. —end note]
[Accepted as a DR at the November, 2018 (San Diego) meeting.]
According to 13.7.7.3 [temp.func.order] paragraph 3,
...If only one of the function templates M is a non-static member of some class A, M is considered to have a new first parameter inserted in its function parameter list. Given cv as the cv-qualifiers of M (if any), the new parameter is of type “rvalue reference to cv A” if the optional ref-qualifier of M is && or if M has no ref-qualifier and the first parameter of the other template has rvalue reference type. Otherwise, the new parameter is of type “lvalue reference to cv A”. [Note: This allows a non-static member to be ordered with respect to a non-member function and for the results to be equivalent to the ordering of two equivalent non-members. —end note]
This gives the wrong answer for an example like:
struct Foo { template <typename T> static T* f(Foo*) { return nullptr; } template <typename T, typename A1> T* f(const A1&) { return nullptr; } }; int main() { Foo x; x.f<int>(&x); }
Presumably this should say something like,
...If only one of the function templates M is a member function, and that function is a non-static member...
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-12-15 00:00:00 | admin | set | messages: + msg6417 |
2018-02-14 00:00:00 | admin | create |