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

--- Comment #14 from CVS 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:155178ccb5f5bc89dcc8261ae1b64bc2fbfdbd45

commit r14-4109-g155178ccb5f5bc89dcc8261ae1b64bc2fbfdbd45
Author: Patrick Palka <ppa...@redhat.com>
Date:   Mon Sep 18 14:41:05 2023 -0400

    c++: always check arity before deduction

    This simple patch extends the r12-3271-gf1e73199569287 optimization
    to happen for deduction without explicit template arguments as well.
    The motivation for this is to accept testcases such as conv20.C and
    ttp40.C below, which don't use explicit template arguments but for
    which unnecessary template instantiation during deduction could be
    avoided if we uniformly pruned overloads according to arity early.
    This incidentally causes us to accept one reduced testcase from
    PR c++/84075, but the underlying issue there remains at large.

    As a nice side effect, this change causes the "candidate expects N
    argument(s)" note during overload resolution failure to point to the
    template candidate instead of the call site, which seems like an
    improvement along the lines of r14-309-g14e881eb030509.

    gcc/cp/ChangeLog:

            * call.cc (add_template_candidate_real): Check arity even
            when there are no explicit template arguments.  Combine the
            two adjacent '!obj' tests into one.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/vt-57397-1.C: Expect "candidate expects ... N
            argument(s)" at the declaration site instead of the call site.
            * g++.dg/cpp0x/vt-57397-2.C: Likewise.
            * g++.dg/overload/template5.C: Likewise.
            * g++.dg/template/local6.C: Likewise.
            * g++.dg/template/conv20.C: New test.
            * g++.dg/template/ttp40.C: New test.

Reply via email to