Thanks to Jim for figuring out how to reproduce the problem, I was able
to apply pr94044-jig.diff to poorly hash the specialization table. (That
places all the specializations of a particular template in the same
bucket, forcing us to compare the arguments.)
The testcase creates sizeof_exprs containing argument packs, and we can
no longer use same_type_p on those.
I did think this was going to be whack-a-mole, but bootstrapping &
testing with the poor hash function, found no other cases. Hurrah!
If it could be tested on arm &| riscv, that'd be additional verification.
nathan
--
Nathan Sidwell
2020-03-20 Nathan Sidwell <nat...@acm.org>
PR c++/94044
* tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
operand.
diff --git i/gcc/cp/tree.c w/gcc/cp/tree.c
index da2e7fdcca3..b85967e1bfa 100644
--- i/gcc/cp/tree.c
+++ w/gcc/cp/tree.c
@@ -3802,9 +3802,13 @@ cp_tree_equal (tree t1, tree t2)
if (SIZEOF_EXPR_TYPE_P (t2))
o2 = TREE_TYPE (o2);
}
+
if (TREE_CODE (o1) != TREE_CODE (o2))
return false;
- if (TYPE_P (o1))
+
+ if (ARGUMENT_PACK_P (o1))
+ return template_args_equal (o1, o2);
+ else if (TYPE_P (o1))
return same_type_p (o1, o2);
else
return cp_tree_equal (o1, o2);
diff --git i/gcc/cp/pt.c w/gcc/cp/pt.c
index 03a8dfbd37c..d8544d66ca5 100644
--- i/gcc/cp/pt.c
+++ w/gcc/cp/pt.c
@@ -1724,7 +1724,12 @@ static hashval_t
hash_tmpl_and_args (tree tmpl, tree args)
{
hashval_t val = iterative_hash_object (DECL_UID (tmpl), 0);
- return iterative_hash_template_arg (args, val);
+#if 0
+ val = iterative_hash_template_arg (args, val);
+#else
+ (void) args;
+#endif
+ return val;
}
/* Returns a hash for a spec_entry node based on the TMPL and ARGS members,