template <typename T> void f(); int main() { f<int> == f<int>; } is rejected with test.cc: In function ‘int main()’: test.cc:2:24: error: invalid operands of types ‘<unresolved overloaded function type>’ and ‘<unresolved overloaded function type>’ to binary ‘operator==’ int main() { f<int> == f<int>; } I see no reason why this would be invalid, and it is accepted by all other compilers I was able to test (clang, Intel, Sun, MSVC), but it is rejected by GCC at least as far back as 4.3.
It is rejected as far back as 2.95.x, so almost certainly not a regression.
Confirmed. Possibly related to PR 64194 although that involves functions with deduced return types, and this one doesn't.
I posted a patch <https://gcc.gnu.org/ml/gcc-patches/2019-04/msg00539.html> over a month ago; I am including the link here in case I end up forgetting to keep pinging.
(In reply to Harald van Dijk from comment #3) > I posted a patch <https://gcc.gnu.org/ml/gcc-patches/2019-04/msg00539.html> > over a month ago; I am including the link here in case I end up forgetting > to keep pinging. Sorry about that and thanks for the patch. It looked fine to me but I'll try to take a closer look at it next week (but won't be able to approve it anyway.)
Author: jason Date: Tue Jun 4 14:48:38 2019 New Revision: 271910 URL: https://gcc.gnu.org/viewcvs?rev=271910&root=gcc&view=rev Log: PR c++/60531 - Wrong error about unresolved overloaded function For PR60531, GCC wrongly rejects function templates with explicitly specified template arguments as overloaded. They are resolved by resolve_nondeduced_context, which is normally called by cp_default_conversion through decay_conversion, but the latter have extra effects making them unusable here. Calling the former directly does work. * typeck.c (cp_build_binary_op): See if overload can be resolved. (cp_build_unary_op): Ditto. * g++.dg/template/operator15.C: New test. Added: trunk/gcc/testsuite/g++.dg/template/operator15.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/typeck.c
Thanks for approving and committing!
*** Bug 86302 has been marked as a duplicate of this bug. ***
*** Bug 71382 has been marked as a duplicate of this bug. ***
*** Bug 81059 has been marked as a duplicate of this bug. ***