Full name of submitter: Anoop Rana
Reference (section label): [over.over]
Link to reflector thread (if any): https://stackoverflow.com/questions/78170991/in-c-why-cant-i-take-the-address-of-a-function-that-also-has-a-templated-vers
Issue description:
I came across the following code that is rejected by all three compilers and seems to be ill-formed as per current wording in over.over#3.
template <typename T>
void AcceptAnything(T&&);
void Foo();
template <typename T>
void Foo();
void Bar() {
AcceptAnything(&Foo);
}
I think this is ill-formed because(as explained here) because the specialization from the function template cannot be formed here so nothing can be added to the set and so it is ill-formed(I may be wrong here but as far as I understand the topic this is what makes it ill-formed). But I don't think the whole program should be ill-formed here as there is another non-template function available that can be used. Instead this inability to form a specialization from the function template can be ignored as a non-template function that can be used is available.
Suggested resolution:
Maybe something like the following can be added:
The program is ill-formed if this is part of the final result of overload resolution.
Full name of submitter: Anoop Rana
Reference (section label): [over.over]
Link to reflector thread (if any): https://stackoverflow.com/questions/78170991/in-c-why-cant-i-take-the-address-of-a-function-that-also-has-a-templated-vers
Issue description:
I came across the following code that is rejected by all three compilers and seems to be ill-formed as per current wording in over.over#3.
I think this is ill-formed because(as explained here) because the specialization from the function template cannot be formed here so nothing can be added to the set and so it is ill-formed(I may be wrong here but as far as I understand the topic this is what makes it ill-formed). But I don't think the whole program should be ill-formed here as there is another non-template function available that can be used. Instead this inability to form a specialization from the function template can be ignored as a non-template function that can be used is available.
Suggested resolution:
Maybe something like the following can be added: