From 326a64554b0ebf03a33a6a55b4467e5d77e62199 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 2 Aug 2011 17:09:08 -0400 Subject: [PATCH] re PR c++/49593 ([C++0x] cannot use T{t}... as pack expansion) PR c++/49593 * pt.c (find_parameter_packs_r): Handle CONSTRUCTOR. From-SVN: r177214 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/pt.c | 1 + gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/cpp0x/variadic115.C | 19 +++++++++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic115.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dc138a187b2..28900c87ce8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-08-02 Jason Merrill + PR c++/49593 + * pt.c (find_parameter_packs_r): Handle CONSTRUCTOR. + PR c++/49803 * init.c (sort_mem_initializers): Initialize uses_unions_p here. (build_field_list): Not here. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3131e613882..571da6ddb7f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3025,6 +3025,7 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) *walk_subtrees = 0; return NULL_TREE; + case CONSTRUCTOR: case TEMPLATE_DECL: cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd, ppd->visited); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6b471694d3c..884162de854 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-08-02 Jason Merrill + PR c++/49593 + * g++.dg/cpp0x/variadic115.C: New. + PR c++/49803 * g++.dg/cpp0x/union5.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic115.C b/gcc/testsuite/g++.dg/cpp0x/variadic115.C new file mode 100644 index 00000000000..fa032e3b022 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic115.C @@ -0,0 +1,19 @@ +// PR c++/49593 +// { dg-options -std=c++0x } + +template void f(T...) { } + +template +static void +g(Args&&... args) +{ + f( static_cast(args)... ); + f( (Args)args... ); + f( Args(args)... ); + f( Args{args}... ); +} + +int main() +{ + g(1, '2', 3.0); +} -- 2.30.2