From a2531859bf5bf6cf1f29c0dca85fd26e80904a5d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 30 Mar 2021 20:31:18 -0400 Subject: [PATCH] c++: Alias template in pack expansion [PR99445] In this testcase, iterative_hash_template_arg checks alias_template_specialization_p to determine whether to treat a type as a dependent alias, and structural_comptypes checks dependent_alias_template_spec_p. Normally that difference isn't a problem because canonicalizing template arguments strips non-dependent aliases, but that wasn't happening for the pack expansion. Fixed thus. gcc/cp/ChangeLog: PR c++/99445 * tree.c (strip_typedefs): Handle TYPE_PACK_EXPANSION. gcc/testsuite/ChangeLog: PR c++/99445 * g++.dg/cpp0x/alias-decl-variadic1.C: New test. --- gcc/cp/tree.c | 9 +++++++++ gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C | 14 ++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 8c4bd15..dca947b 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1722,6 +1722,15 @@ strip_typedefs (tree t, bool *remove_attributes, unsigned int flags) remove_attributes, flags); result = finish_underlying_type (type); break; + case TYPE_PACK_EXPANSION: + type = strip_typedefs (PACK_EXPANSION_PATTERN (t), + remove_attributes, flags); + if (type != PACK_EXPANSION_PATTERN (t)) + { + result = copy_node (t); + PACK_EXPANSION_PATTERN (result) = type; + } + break; default: break; } diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C new file mode 100644 index 0000000..68b3a7f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C @@ -0,0 +1,14 @@ +// PR c++/99445 +// { dg-do compile { target c++11 } } +// { dg-additional-options "-fchecking=2 --param=hash-table-verification-limit=1000" } + +template struct implicit_conversions; +template +using implicit_conversions_t = typename implicit_conversions::type; +template struct response_type; + +template +using type1 = response_type...>; + +template +using type2 = response_type::type...>; -- 2.7.4