re PR c++/48736 ([C++0x] ICE during list-initialization with variadics)
authorJason Merrill <jason@redhat.com>
Tue, 10 May 2011 17:58:38 +0000 (13:58 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 10 May 2011 17:58:38 +0000 (13:58 -0400)
PR c++/48736
* pt.c (tsubst_copy_and_build): Handle substitution of a pack
expansion producing another expansion.

From-SVN: r173627

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

index aa2d2f51c3629c0ca6bb983dd82e22ecae8064dd..34359f01fde2242c8f8c822b46dce5d732ea0ee2 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-10  Jason Merrill  <jason@redhat.com>
+
+       PR c++/48736
+       * pt.c (tsubst_copy_and_build): Handle substitution of a pack
+       expansion producing another expansion.
+
 2011-05-10  Ville Voutilainen  <ville.voutilainen@gmail.com>
 
        Fixes for override/final.
index f6392d63b818b29720c27325614ed09b00ee9fd4..5e2497796fd11aed0a511647393fb8c32fbf767c 100644 (file)
@@ -13250,7 +13250,8 @@ tsubst_copy_and_build (tree t,
                 ce->value = tsubst_pack_expansion (ce->value, args, complain,
                                                   in_decl);
 
-               if (ce->value == error_mark_node)
+               if (ce->value == error_mark_node
+                   || PACK_EXPANSION_P (ce->value))
                  ;
                else if (TREE_VEC_LENGTH (ce->value) == 1)
                   /* Just move the argument into place.  */
index e133d9d7da001247365963c8f59926729a873766..4a63e60e1446e311f5264983d34652397782dd8f 100644 (file)
@@ -1,3 +1,7 @@
+2011-05-10  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/variadic108.C: New.
+
 2011-05-10  Ville Voutilainen  <ville.voutilainen@gmail.com>
 
        * g++.dg/inherit/virtual9.C: Extend.
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic108.C b/gcc/testsuite/g++.dg/cpp0x/variadic108.C
new file mode 100644 (file)
index 0000000..3ad5af4
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/48736
+// { dg-options -std=c++0x }
+
+template<class T>
+T&& create();
+
+template<class T, class... Args,
+ class = decltype(T{create<Args>()...}) // Line X
+>
+char f(int);