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

--- Comment #2 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:80968d5f4683ffb50dbe8051d10f754d5fd00dfb

commit r14-4112-g80968d5f4683ffb50dbe8051d10f754d5fd00dfb
Author: Patrick Palka <ppa...@redhat.com>
Date:   Mon Sep 18 14:54:45 2023 -0400

    c++: optimize unifying nested templated classes [PR89231]

    Since the LHS of a qualified-id is a non-deduced context, it effectively
    means we can't deduce from outer template arguments of a class template
    specialization.  And checking for equality between the TI_TEMPLATE of a
    class specialization parm/arg already implies that the outer template
    arguments are the same.  Hence recursing into outer template arguments
    during unification of class specializations is redundant, so this patch
    makes unify recurse only into innermost arguments.

    This incidentally fixes the testcase from PR89231 because there
    more_specialized_partial_inst wrongly considers the two partial
    specializations to be unordered ultimately because unify for identical
    parm=arg=A<Ps...>::Collect<N...> gets confused when it recurses into
    parm=arg={Ps...} since Ps is outside the (innermost) level of tparms
    that we're actually deducing.

            PR c++/89231

    gcc/cp/ChangeLog:

            * pt.cc (try_class_unification): Strengthen TI_TEMPLATE equality
            test by not calling most_general_template.  Only unify the
            innermost levels of template arguments.
            (unify) <case CLASS_TYPE>: Only unify the innermost levels of
            template arguments, and only if the template is primary.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/variadic-partial3.C: New test.

Reply via email to