aboutsummaryrefslogtreecommitdiff
path: root/libiberty/dyn-string.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-01-27 17:15:39 -0500
committerJason Merrill <jason@redhat.com>2021-02-01 09:49:42 -0500
commit6e0a231a4aa2407bb7167daf98a37795a67364d8 (patch)
tree0683075c4ce5a5cf8691e6eb6cc1a84241a999fa /libiberty/dyn-string.c
parentbec5dbae5649da4bd7ea2731a8446ac481cb78ab (diff)
downloadgcc-6e0a231a4aa2407bb7167daf98a37795a67364d8.zip
gcc-6e0a231a4aa2407bb7167daf98a37795a67364d8.tar.gz
gcc-6e0a231a4aa2407bb7167daf98a37795a67364d8.tar.bz2
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.
Diffstat (limited to 'libiberty/dyn-string.c')
0 files changed, 0 insertions, 0 deletions