diff mbox series

[pushed] c++: Fix alias comparison [PR98926]

Message ID 20210203175121.1992383-1-jason@redhat.com
State New
Headers show
Series [pushed] c++: Fix alias comparison [PR98926] | expand

Commit Message

Jason Merrill Feb. 3, 2021, 5:51 p.m. UTC
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.

Tested x86_64-pc-linux-gnu (with the strict-gc parms below), applying to trunk.

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/pt.c                                    | 2 ++
 gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1558.C | 1 +
 gcc/cp/Make-lang.in                            | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)


base-commit: 5c3d388aee5609d32bd8e3ba1add776b1a6f0d1f
diff mbox series

Patch

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<typename...> using void_t = void;
 template<class T> struct A { };
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.