Jason Merrill <ja...@redhat.com> writes: > On 12/21/2012 07:35 AM, Dodji Seketeli wrote: >> else if (TREE_TYPE (t) >> && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (t)) >> - && !TREE_CONSTANT (t)) >> + && !TREE_CONSTANT (t) >> + /* Class template and alias template arguments should be OK. */ >> + && !DECL_TYPE_TEMPLATE_P (t)) > > Instead, let's add a previous else if to catch template template > arguments (and do nothing) so that when we hit this else if, we know > we're dealing with a non-type argument.
Right. Here you go. Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk. gcc/cp/ PR c++/52343 * pt.c (check_instantiated_arg): Allow type template arguments. gcc/testsuite/ PR c++/52343 * g++.dg/cpp0x/alias-decl-29.C: New test. --- gcc/cp/pt.c | 3 +++ gcc/testsuite/g++.dg/cpp0x/alias-decl-29.C | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-29.C diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1b3f039..9e99c09 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14421,6 +14421,9 @@ check_instantiated_arg (tree tmpl, tree t, tsubst_flags_t complain) return true; } } + /* Class template and alias template arguments should be OK. */ + else if (DECL_TYPE_TEMPLATE_P (t)) + ; /* A non-type argument of integral or enumerated type must be a constant. */ else if (TREE_TYPE (t) diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-29.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-29.C new file mode 100644 index 0000000..f6cc695 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-29.C @@ -0,0 +1,10 @@ +// Origin: PR c++/52343 +// { dg-do compile { target c++11 } } + +template<typename> +using A = int; + +template<template<class> class> +struct B {}; + +B<A> b; -- Dodji