https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97187
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:4192ffd74c69e3fb6d761becc8e5117c3de42052 commit r11-5677-g4192ffd74c69e3fb6d761becc8e5117c3de42052 Author: Marek Polacek <pola...@redhat.com> Date: Mon Nov 30 14:53:24 2020 -0500 c++: Fix tsubst ICE with invalid code [PR97993, PR97187] I had a strong sense of deja vu when looking into this, and no wonder, since this is almost identical to c++/95728. Since r11-423 tsubst_copy_and_build/TREE_LIST uses tsubst_tree_list instead of open coding it. While the latter could return an error node wrapped in a TREE_LIST, the former can return a naked error node. That broke in tsubst_copy_and_build/NEW_EXPR, because we were accessing TREE_VALUE of an error node. gcc/cp/ChangeLog: PR c++/97187 PR c++/97993 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node if init is erroneous. gcc/testsuite/ChangeLog: PR c++/97187 PR c++/97993 * g++.dg/eh/crash2.C: New test. * g++.dg/template/crash132.C: New test.