From 91db8b1345b0d48c4b4a082843377702a0e6c55e Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 25 May 2011 15:52:10 -0400 Subject: [PATCH] re PR c++/45698 (C++0x Variadic Templates: Infinite template recursion rather than an error message) PR c++/45698 * pt.c (dependent_template_arg_p): See through ARGUMENT_PACK_SELECT. From-SVN: r174229 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/pt.c | 3 +++ gcc/testsuite/ChangeLog | 2 ++ gcc/testsuite/g++.dg/cpp0x/variadic110.C | 15 +++++++++++++++ 4 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic110.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7493fd2f512..204fea6e729 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-05-25 Jason Merrill + PR c++/45698 + * pt.c (dependent_template_arg_p): See through ARGUMENT_PACK_SELECT. + PR c++/46145 * decl.c (grokdeclarator): Complain about auto typedef. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c3c759e38aa..c9c25cd2c55 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18759,6 +18759,9 @@ dependent_template_arg_p (tree arg) if (arg == error_mark_node) return true; + if (TREE_CODE (arg) == ARGUMENT_PACK_SELECT) + arg = ARGUMENT_PACK_SELECT_ARG (arg); + if (TREE_CODE (arg) == TEMPLATE_DECL || TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM) return dependent_template_p (arg); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7e88ecc8b5f..2a30f6e8bbc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-05-25 Jason Merrill + * g++.dg/cpp0x/variadic110.C: New. + * g++.dg/cpp0x/auto9.C: Add typedef test. * g++.dg/cpp0x/auto23.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic110.C b/gcc/testsuite/g++.dg/cpp0x/variadic110.C new file mode 100644 index 00000000000..86f1bb1543c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic110.C @@ -0,0 +1,15 @@ +// PR c++/45698 +// { dg-options -std=c++0x } + +template struct tuple { }; + +template +struct A { + template struct N { }; + tuple...> tup; +}; + +int main() +{ + A a; +} -- 2.30.2