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

--- Comment #3 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:5348e3cb9bc99d2ee4d7438b8eca5c92fff5b931

commit r15-3038-g5348e3cb9bc99d2ee4d7438b8eca5c92fff5b931
Author: Patrick Palka <ppa...@redhat.com>
Date:   Tue Aug 20 08:34:36 2024 -0400

    c++: default targ eligibility refinement [PR101463]

    On Tue, 9 Jan 2024, Jason Merrill wrote:
    > On 1/5/24 15:01, Patrick Palka wrote[1]:
    > > Here during default template argument substitution we wrongly consider
    > > the (substituted) default arguments v and vt<int> as value-dependent[1]
    > > which ultimately leads to deduction failure for the calls.
    > >
    > > The bogus value_dependent_expression_p result aside, I noticed
    > > type_unification_real during default targ substitution keeps track of
    > > whether all previous targs are known and non-dependent, as is the case
    > > for these calls.  And in such cases it should be safe to avoid checking
    > > dependence of the substituted default targ and just assume it's not.
    > > This patch implements this optimization, which lets us accept both
    > > testcases by sidestepping the value_dependent_expression_p issue
    > > altogether.
    >
    > Hmm, maybe instead of substituting and asking if it's dependent, we
should
    > specifically look for undeduced parameters.

    This patch implements this refinement, which incidentally fixes PR101463
    just as well.

    [1]: https://gcc.gnu.org/pipermail/gcc-patches/2024-January/641957.html

            PR c++/101463

    gcc/cp/ChangeLog:

            * pt.cc (type_unification_real): Directly look for undeduced
            parameters in the default argument instead of doing a trial
            substitution.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/nontype6.C: New test.
            * g++.dg/cpp1z/nontype6a.C: New test.

    Reviewed-by: Jason Merrill <ja...@redhat.com>

Reply via email to