c++: hash table ICE with variadic alias [PR105003]
commitfc50d9a252c89c1bac78192bd0884ff23f2bf48b
authorJason Merrill <jason@redhat.com>
Fri, 25 Mar 2022 17:13:35 +0000 (25 13:13 -0400)
committerJason Merrill <jason@redhat.com>
Mon, 28 Mar 2022 14:57:08 +0000 (28 10:57 -0400)
tree39af0141a157f237413eb184d164565540188dde
parent875342766d42988fa2f8eb7d34ef562ba69e340a
c++: hash table ICE with variadic alias [PR105003]

For PR104008 we thought it might be enough to keep strip_typedefs from
removing this alias template specialization, but this PR demonstrates that
other parts of the compiler also need to know to consider it dependent.

So, this patch changes complex_alias_template_p to no longer consider
template parameters used when their only use appears in a pack expansion,
unless they are the parameter packs being expanded.

To do that I also needed to change it to use cp_walk_tree instead of
for_each_template_parm.  It occurs to me that find_template_parameters
should probably also use cp_walk_tree, but I'm not messing with that now.

PR c++/105003
PR c++/104008
PR c++/102869

gcc/cp/ChangeLog:

* pt.cc (complex_alias_template_r): walk_tree callback, replacing
uses_all_template_parms_r, complex_pack_expansion_r.
(complex_alias_template_p): Adjust.
* tree.cc (strip_typedefs): Revert r12-7710 change.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/variadic-alias6.C: New test.
* g++.dg/cpp0x/variadic-alias7.C: New test.
gcc/cp/pt.cc
gcc/cp/tree.cc
gcc/testsuite/g++.dg/cpp0x/variadic-alias6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/variadic-alias7.C [new file with mode: 0644]