https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119034
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:1fb5abc3919f376f3dedccad636eba4a4ad7e4a7 commit r16-330-g1fb5abc3919f376f3dedccad636eba4a4ad7e4a7 Author: Patrick Palka <ppa...@redhat.com> Date: Thu May 1 10:58:50 2025 -0400 c++: more overeager use of deleted function before ADL [PR119034] The PR68942 fix used the tf_conv flag to disable mark_used when substituting a FUNCTION_DECL callee of an ADL-enabled call. In this slightly more elaborate testcase, we end up prematurely calling mark_used anyway on the FUNCTION_DECL directly from the CALL_EXPR case of tsubst_expr during partial instantiation, leading to a bogus "use of deleted function" error. This patch fixes the general problem in a more robust way by ensuring the callee of an ADL-enabled call is wrapped in an OVERLOAD, so that tsubst_expr leaves it alone. PR c++/119034 PR c++/68942 gcc/cp/ChangeLog: * pt.cc (tsubst_expr) <case CALL_EXPR>: Revert PR68942 fix. * semantics.cc (finish_call_expr): Ensure the callee of an ADL-enabled call is wrapped in an OVERLOAD. gcc/testsuite/ChangeLog: * g++.dg/template/koenig13.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com>