From 26863a324a5697fe20d2fb8610010551785a9a15 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 9 May 2013 12:43:49 -0400 Subject: [PATCH] re PR c++/57222 (Template alias not working in argument of template class template method) PR c++/57222 * pt.c (lookup_template_class_1): Handle getting a template template parameter as D1. From-SVN: r198747 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 7 ++++++- gcc/testsuite/g++.dg/cpp0x/alias-decl-34.C | 23 ++++++++++++++++++++++ gcc/testsuite/g++.dg/template/crash84.C | 7 ++++--- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-34.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 74480f65339..a254a8e74e2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2013-05-09 Jason Merrill + PR c++/57222 + * pt.c (lookup_template_class_1): Handle getting a template + template parameter as D1. + N3639 C++1y VLA diagnostics * decl.c (grokdeclarator): Complain about reference, pointer, or typedef to VLA. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2cb2abd213f..0747de62df6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7016,7 +7016,7 @@ maybe_get_template_decl_from_type_decl (tree decl) ? CLASSTYPE_TI_TEMPLATE (TREE_TYPE (decl)) : decl; } -/* Given an IDENTIFIER_NODE (type TEMPLATE_DECL) and a chain of +/* Given an IDENTIFIER_NODE (or type TEMPLATE_DECL) and a chain of parameters, find the desired type. D1 is the PTYPENAME terminal, and ARGLIST is the list of arguments. @@ -7097,6 +7097,11 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, d1 = DECL_NAME (templ); context = DECL_CONTEXT (templ); } + else if (DECL_TEMPLATE_TEMPLATE_PARM_P (d1)) + { + templ = d1; + d1 = DECL_NAME (templ); + } /* Issue an error message if we didn't find a template. */ if (! templ) diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-34.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-34.C new file mode 100644 index 00000000000..4306ab70327 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-34.C @@ -0,0 +1,23 @@ +// PR c++/57222 +// { dg-require-effective-target c++11 } + +template