https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94507
--- Comment #4 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:77d6dfc929832a542a25fc455b90f1a4bc83229c commit r10-7636-g77d6dfc929832a542a25fc455b90f1a4bc83229c Author: Marek Polacek <pola...@redhat.com> Date: Mon Apr 6 19:59:04 2020 -0400 c++: Fix ICE-on-invalid with lambda template [PR94507] While reducing something else I noticed that we ICE on the following invalid code. In tsubst_lambda_expr, tsubst_template_decl has already reported an error and returned the error_mark_node, so make sure we don't ICE on that. I'm using a goto here because we still have to do finish_struct because it does popclass (). PR c++/94507 - ICE-on-invalid with lambda template. * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or tsubst_function_decl returns error_mark_node. * g++.dg/cpp2a/lambda-generic7.C: New test.