/* We only want to compute the number of arguments. */
tree expanded = tsubst_pack_expansion (TREE_OPERAND (t, 0), args,
complain, in_decl);
+ if (expanded == error_mark_node)
+ return error_mark_node;
return build_int_cst (size_type_node, TREE_VEC_LENGTH (expanded));
}
/* Fall through */
/* We only want to compute the number of arguments. */
tree expanded = tsubst_pack_expansion (TREE_OPERAND (t, 0), args,
complain, in_decl);
+ if (expanded == error_mark_node)
+ return error_mark_node;
return build_int_cst (size_type_node, TREE_VEC_LENGTH (expanded));
}
/* Fall through */
ce->value = tsubst_pack_expansion (ce->value, args, complain,
in_decl);
- if (TREE_VEC_LENGTH (ce->value) == 1)
+ if (ce->value == error_mark_node)
+ ;
+ else if (TREE_VEC_LENGTH (ce->value) == 1)
/* Just move the argument into place. */
ce->value = TREE_VEC_ELT (ce->value, 0);
else
2007-09-20 Jakub Jelinek <jakub@redhat.com>
+ PR c++/33496
+ * g++.dg/cpp0x/variadic76.C: New test.
+ * g++.dg/cpp0x/variadic77.C: New test.
+ * g++.dg/cpp0x/variadic78.C: New test.
+
PR c/33238
PR c/27301
* gcc.c-torture/execute/20070919-1.c: New test.
--- /dev/null
+// PR c++/33496
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+template<int... N> int foo ()
+{
+ return sizeof... N (); // { dg-error "cannot be used as a function" }
+}
+
+int bar ()
+{
+ return foo<0> ();
+}
--- /dev/null
+// PR c++/33496
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+template<int M, int N> struct pair
+{
+ int i, j;
+ pair () : i (M), j (N) {}
+};
+
+template<int... M> struct S
+{
+ template<int... N> static int foo ()
+ {
+ return sizeof... (pair<M, N>); // { dg-error "mismatched argument pack lengths" }
+ }
+};
+
+int bar ()
+{
+ return S<0, 1, 2>::foo<0, 1> ();
+}
--- /dev/null
+// PR c++/33496
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+template<int M, int N> struct pair
+{
+ int i, j;
+ pair () : i (M), j (N) {}
+};
+
+template<int... M> struct S
+{
+ template<int... N> static int *foo ()
+ {
+ static int x[] = { (M + N)... }; // { dg-error "mismatched argument pack lengths" }
+ return x;
+ }
+};
+
+int *bar ()
+{
+ return S<0, 1, 2>::foo<0, 1> ();
+}