]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: more overeager use of deleted function before ADL [PR119034]
authorPatrick Palka <ppalka@redhat.com>
Thu, 1 May 2025 14:58:50 +0000 (10:58 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 1 May 2025 14:58:50 +0000 (10:58 -0400)
commit1fb5abc3919f376f3dedccad636eba4a4ad7e4a7
tree664200f6850de41ca571aa63ea893cc5deeeda25
parent0abc77da9d704bba55a376bb5c162a54826ab94a
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 <jason@redhat.com>
gcc/cp/pt.cc
gcc/cp/semantics.cc
gcc/testsuite/g++.dg/template/koenig13.C [new file with mode: 0644]