From 5c62e4f255bfac65e18213fd93ee1c9908b4a750 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 3 Feb 2021 00:29:00 -0500 Subject: [PATCH] c++: Fix alias comparison [PR98926] The comparison of dependent aliases wasn't working here because processing_template_decl wasn't set, so dependent_alias_template_spec_p was always returning false. gcc/cp/ChangeLog: PR c++/98926 PR c++/98570 * pt.c (spec_hasher::equal): Set processing_template_decl. * Make-lang.in (check-g++-strict-gc): Add --param hash-table-verification-limit=10000. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/alias-decl-dr1558.C: Pass --param hash-table-verification-limit=10000. --- gcc/cp/Make-lang.in | 2 +- gcc/cp/pt.c | 2 ++ gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1558.C | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 62295fb0dfe..155be74efdb 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -224,7 +224,7 @@ check-c++-all: # Run the testsuite with garbage collection at every opportunity. check-g++-strict-gc: - $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --extra_opts,--param,ggc-min-heapsize=0,--param,ggc-min-expand=0" \ + $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --extra_opts,--param,ggc-min-heapsize=0,--param,ggc-min-expand=0,--param,hash-table-verification-limit=10000" \ TESTSUITEDIR="$(TESTSUITEDIR).gc" check-g++ check-c++-subtargets : check-g++-subtargets # List of targets that can use the generic check- rule and its // variant. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 4781519d00f..c5b0a9292db 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1720,6 +1720,7 @@ spec_hasher::equal (spec_entry *e1, spec_entry *e2) ++comparing_specializations; ++comparing_dependent_aliases; + ++processing_template_decl; equal = (e1->tmpl == e2->tmpl && comp_template_args (e1->args, e2->args)); if (equal && flag_concepts @@ -1734,6 +1735,7 @@ spec_hasher::equal (spec_entry *e1, spec_entry *e2) tree c2 = e2->spec ? get_constraints (e2->spec) : NULL_TREE; equal = equivalent_constraints (c1, c2); } + --processing_template_decl; --comparing_dependent_aliases; --comparing_specializations; diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1558.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1558.C index 2bbb138ec22..8495462bd6d 100644 --- a/gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1558.C +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1558.C @@ -1,5 +1,6 @@ // DR 1558 still applies when using void_t as a template-argument. // { dg-do compile { target c++11 } } +// { dg-additional-options "--param hash-table-verification-limit=10000" } template using void_t = void; template struct A { }; -- 2.30.2