[Bug c++/124357] Type inference depends on the order of arguments

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Mar 7 15:41:21 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124357

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
All four compilers successfully compile this example from the standard:

// The overload set contains a template, causing the second function parameter
to be a non-deduced context.
template <class T> int f(T, T (*p)(T));
char g(char);
template <class T> T g(T);
int i = f(1, g);    // calls f(int, int (*)(int))

They seem to disagree on whether int(*)(T, U) can be deduced when T has already
been deduced from an earlier parameter.


More information about the Gcc-bugs mailing list