re PR c++/49593 ([C++0x] cannot use T{t}... as pack expansion)
authorJason Merrill <jason@redhat.com>
Tue, 2 Aug 2011 21:09:08 +0000 (17:09 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 2 Aug 2011 21:09:08 +0000 (17:09 -0400)
PR c++/49593
* pt.c (find_parameter_packs_r): Handle CONSTRUCTOR.

From-SVN: r177214

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/variadic115.C [new file with mode: 0644]

index dc138a187b2a465a445ff26c51e82716bf914c5e..28900c87ce88a80bc47d703e2e367892a9a353d3 100644 (file)
@@ -1,5 +1,8 @@
 2011-08-02  Jason Merrill  <jason@redhat.com>
 
+       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.
index 3131e613882fa85016397b32c13ab333678d7159..571da6ddb7f21b35d0b7447311627c2d8b902aaf 100644 (file)
@@ -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);
index 6b471694d3ce82abf3187abb53b00561d4f54700..884162de8544d246203182baa60c410f201b74ec 100644 (file)
@@ -1,5 +1,8 @@
 2011-08-02  Jason Merrill  <jason@redhat.com>
 
+       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 (file)
index 0000000..fa032e3
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/49593
+// { dg-options -std=c++0x }
+
+template<typename... T> void f(T...) { }
+
+template<typename... Args>
+static void
+g(Args&&... args)
+{
+  f( static_cast<Args>(args)... );
+  f( (Args)args... );
+  f( Args(args)... );
+  f( Args{args}... );
+}
+
+int main()
+{
+  g(1, '2', 3.0);
+}