Skip to content

Commit

Permalink
c++: Alias template in pack expansion [PR99445]
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jicama committed Mar 31, 2021
1 parent 05de071 commit a253185
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gcc/cp/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 14 additions & 0 deletions gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic1.C
Original file line number Diff line number Diff line change
@@ -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 <class> struct implicit_conversions;
template <class T>
using implicit_conversions_t = typename implicit_conversions<T>::type;
template <class...> struct response_type;

template <class Handle, class... Ts>
using type1 = response_type<implicit_conversions_t<Ts>...>;

template <class Handle, class... Ts>
using type2 = response_type<typename implicit_conversions<Ts>::type...>;

0 comments on commit a253185

Please sign in to comment.