+2011-03-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/47974
+ * pt.c (tsubst_template_args): Check argument t for error_mark_node.
+
2011-03-03 Jason Merrill <jason@redhat.com>
PR c++/47950
tsubst_template_args (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
tree orig_t = t;
- int len = TREE_VEC_LENGTH (t);
- int need_new = 0, i, expanded_len_adjust = 0, out;
- tree *elts = XALLOCAVEC (tree, len);
+ int len, need_new = 0, i, expanded_len_adjust = 0, out;
+ tree *elts;
+
+ if (t == error_mark_node)
+ return error_mark_node;
+
+ len = TREE_VEC_LENGTH (t);
+ elts = XALLOCAVEC (tree, len);
for (i = 0; i < len; i++)
{
--- /dev/null
+// PR c++/47974
+
+typedef double T;
+
+struct A
+{
+ template<T> void foo(); // { dg-error "type" }
+};
+
+template<T N = 0, void (A::*)() = &A::foo<N> > struct B {}; // { dg-error "type|declared" }
+
+B<> b; // { dg-error "type|declaration" }