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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:6e0a231a4aa2407bb7167daf98a37795a67364d8

commit r11-7011-g6e0a231a4aa2407bb7167daf98a37795a67364d8
Author: Jason Merrill <ja...@redhat.com>
Date:   Wed Jan 27 17:15:39 2021 -0500

    c++: alias in qualified-id in template arg [PR98570]

    template_args_equal has handled dependent alias specializations for a
while,
    but in this testcase the actual template argument is a SCOPE_REF, so we
    called cp_tree_equal, which doesn't handle aliases specially when we get to
    them.

    This patch generalizes this by setting a flag so structural_comptypes will
    check for template alias equivalence (if we aren't doing partial ordering).
    The existing flag, comparing_specializations, was too broad; in particular,
    when we're doing decls_match, we want to treat corresponding parameters as
    equivalent, so we need to separate that from alias comparison.  So I
    introduce the comparing_dependent_aliases flag.

    From looking at other uses of comparing_specializations, it seems to me
that
    the new flag is what modules wants, as well.

    The other use of comparing_specializations in structural_comptypes is a
hack
    to deal with spec_hasher::equal not calling push_to_top_level, which we
    also don't want to tie to the alias comparison semantics.

    This patch also changes how we get to structural comparison of aliases from
    checking TYPE_CANONICAL in comptypes to marking the aliases as getting
    structural comparison when they are built, which is more consistent with
how
    e.g. typename is handled.

    As I mention in the comment for comparing_dependent_aliases, I think the
    default should be to treat different dependent aliases for the same type as
    distinct, only treating them as equal during deduction (particularly
partial
    ordering).  But that's a matter for the C++ committee, to try in stage 1.

    gcc/cp/ChangeLog:

            PR c++/98570
            * cp-tree.h: Declare it.
            * pt.c (comparing_dependent_aliases): New flag.
            (template_args_equal, spec_hasher::equal): Set it.
            (dependent_alias_template_spec_p): Assert that we don't
            get non-types other than error_mark_node.
            (instantiate_alias_template): SET_TYPE_STRUCTURAL_EQUALITY
            on complex alias specializations.  Set TYPE_DEPENDENT_P here.
            (tsubst_decl): Not here.
            * module.cc (module_state::read_cluster): Set
            comparing_dependent_aliases instead of
            comparing_specializations.
            * tree.c (cp_tree_equal): Remove comparing_specializations
            module handling.
            * typeck.c (structural_comptypes): Adjust.
            (comptypes): Remove comparing_specializations handling.

    gcc/testsuite/ChangeLog:

            PR c++/98570
            * g++.dg/cpp0x/alias-decl-targ1.C: New test.

Reply via email to