c++: Fix alias comparison [PR98926]
authorJason Merrill <jason@redhat.com>
Wed, 3 Feb 2021 05:29:00 +0000 (00:29 -0500)
committerJason Merrill <jason@redhat.com>
Wed, 3 Feb 2021 17:50:18 +0000 (12:50 -0500)
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
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1558.C

index 62295fb0dfee1ae1890e36754316cc08876d7376..155be74efdb0e063e6da3d6e9da903afb687ac38 100644 (file)
@@ -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.
index 4781519d00fe068b12dc64fae468ddfa602443f3..c5b0a9292db6ac4b966d28dd7a4b30c09936c24e 100644 (file)
@@ -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;
 
index 2bbb138ec22c386dd1f9c5e47e63b2c6d4d0bade..8495462bd6d630d189b144fc93413918f2f0e89b 100644 (file)
@@ -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 { };