From f3417723b7829dda4e795a4cbff2765553667b5a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 26 Feb 2014 12:01:12 -0500 Subject: [PATCH] re PR c++/60182 (g++ segfault within template expansion using "using" aliasing) PR c++/60182 * pt.c (unify): Ignore alias templates when deducing a template template parameter. From-SVN: r208177 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 4 +++- gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ce6085d736f..b2e687c3ab3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-02-26 Jason Merrill + PR c++/60182 + * pt.c (unify): Ignore alias templates when deducing a template + template parameter. + PR c++/60345 Revert: DR 1571 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 4a9fa7154be..d72331182da 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -17390,9 +17390,11 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, if (TREE_CODE (arg) != BOUND_TEMPLATE_TEMPLATE_PARM && !CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P (arg)) return unify_template_deduction_failure (explain_p, parm, arg); - { tree parmvec = TYPE_TI_ARGS (parm); + /* An alias template name is never deduced. */ + if (TYPE_ALIAS_P (arg)) + arg = strip_typedefs (arg); tree argvec = INNERMOST_TEMPLATE_ARGS (TYPE_TI_ARGS (arg)); tree full_argvec = add_to_template_args (targs, argvec); tree parm_parms diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C new file mode 100644 index 00000000000..c444217b0ee --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C @@ -0,0 +1,18 @@ +// PR c++/60182 +// { dg-require-effective-target c++11 } + +class B {}; +template using __allocator_base = B; +template class F : __allocator_base {}; +class C {}; +template > class G : C {}; +template class D; +class A { + using Container = G>; + A(); + A(D const &); + Container m_elements; +}; +template