From: Paolo Carlini Date: Thu, 3 Mar 2011 17:07:28 +0000 (+0000) Subject: re PR c++/47974 (ICE: tree check: expected tree_vec, have error_mark in tsubst_templa... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5c62e6611d4b12f6fdf10743dd4d691d2d6d8962;p=gcc.git re PR c++/47974 (ICE: tree check: expected tree_vec, have error_mark in tsubst_template_args, at cp/pt.c:8969 on invalid code) /cp 2011-03-03 Paolo Carlini PR c++/47974 * pt.c (tsubst_template_args): Check argument t for error_mark_node. /testsuite 2011-03-03 Paolo Carlini PR c++/47974 * g++.dg/template/crash106.C: New. From-SVN: r170658 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ef766fbff3d..747457a1937 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-03-03 Paolo Carlini + + PR c++/47974 + * pt.c (tsubst_template_args): Check argument t for error_mark_node. + 2011-03-03 Jason Merrill PR c++/47950 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 60b26996c47..c52bb74eba8 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8966,9 +8966,14 @@ static tree 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++) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3f7a372fa0a..69b7569c615 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-03-03 Paolo Carlini + + PR c++/47974 + * g++.dg/template/crash106.C: New. + 2011-03-03 Jakub Jelinek PR c/47963 diff --git a/gcc/testsuite/g++.dg/template/crash106.C b/gcc/testsuite/g++.dg/template/crash106.C new file mode 100644 index 00000000000..c2d117e03a0 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash106.C @@ -0,0 +1,12 @@ +// PR c++/47974 + +typedef double T; + +struct A +{ + template void foo(); // { dg-error "type" } +}; + +template > struct B {}; // { dg-error "type|declared" } + +B<> b; // { dg-error "type|declaration" }