Hi, this fixes an ICE on invalid new in mainline. Tested x86_64-linux.
Ok? Thanks, Paolo. ////////////////////
/cp 2011-10-25 Paolo Carlini <paolo.carl...@oracle.com> PR c++/50861 * pt.c (tsubst_copy_and_build): Check return value of tsubst_copy_and_build for error_mark_node. /testsuite 2011-10-25 Paolo Carlini <paolo.carl...@oracle.com> PR c++/50861 * g++.dg/template/crash108.C: New.
Index: testsuite/g++.dg/template/crash108.C =================================================================== --- testsuite/g++.dg/template/crash108.C (revision 0) +++ testsuite/g++.dg/template/crash108.C (revision 0) @@ -0,0 +1,5 @@ +// PR c++/50861 + +template<class T> struct A {A(int b=k(0));}; // { dg-error "arguments" } +void f(int k){A<int> a;} // // { dg-error "parameter|declared" } +// { dg-message "note" { target *-*-* } 3 } Index: cp/pt.c =================================================================== --- cp/pt.c (revision 180424) +++ cp/pt.c (working copy) @@ -13511,6 +13511,9 @@ tsubst_copy_and_build (tree t, tree unq = (tsubst_copy_and_build (function, args, complain, in_decl, true, integral_constant_expression_p)); + if (unq == error_mark_node) + return error_mark_node; + if (unq != function) { tree fn = unq;