Comments
Patch
@@ -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. */
new file mode 100644
@@ -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);
tsubst_copy_and_build was assuming that substituting into a pack expansion would always produce a vector of elements, which is not true if the template arguments are still dependent. Tested x86_64-pc-linux-gnu, applied to trunk. commit 3bc57a5e66cd7a4e6e9a77900249db0bf193456b Author: Jason Merrill <jason@redhat.com> Date: Mon May 9 17:13:55 2011 -0400 PR c++/48736 * pt.c (tsubst_copy_and_build): Handle substitution of a pack expansion producing another expansion.