Patchwork C++ PATCH for c++/49593 (failure with T{/**/}...)

login
register
mail settings
Submitter Jason Merrill
Date Aug. 2, 2011, 9:14 p.m.
Message ID <4E3868B4.70108@redhat.com>
Download mbox | patch
Permalink /patch/108002/
State New
Headers show

Comments

Jason Merrill - Aug. 2, 2011, 9:14 p.m.
We need to look for packs in the type of a CONSTRUCTOR to handle 
list-initialized temporaries.

Tested x86_64-pc-linux-gnu, applied to trunk.

Patch

commit 642c479a11613a80ea8eea986178be0cc60e5a39
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Aug 2 21:09:08 2011 +0000

    	PR c++/49593
    	* pt.c (find_parameter_packs_r): Handle CONSTRUCTOR.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177214 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3131e61..571da6d 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/g++.dg/cpp0x/variadic115.C b/gcc/testsuite/g++.dg/cpp0x/variadic115.C
new file mode 100644
index 0000000..fa032e3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic115.C
@@ -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);
+}