From: Jason Merrill Date: Wed, 26 Feb 2014 17:01:12 +0000 (-0500) Subject: re PR c++/60182 (g++ segfault within template expansion using "using" aliasing) X-Git-Tag: releases/gcc-4.9.0~654 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3417723b7829dda4e795a4cbff2765553667b5a;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ce6085d736fb..b2e687c3ab38 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 4a9fa7154beb..d72331182da6 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 000000000000..c444217b0ee0 --- /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