https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108438
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Simon Martin <simar...@gcc.gnu.org>: https://gcc.gnu.org/g:2c9643c27ecddb7f597d34009d89e932b4aca58e commit r15-1114-g2c9643c27ecddb7f597d34009d89e932b4aca58e Author: Simon Martin <si...@nasilyan.com> Date: Fri Jun 7 11:21:07 2024 +0200 c++: Make *_cast<*> parsing more robust to errors [PR108438] We ICE upon the following when trying to emit a -Wlogical-not-parentheses warning: === cut here === template <typename T> T foo (T arg, T& ref, T* ptr) { int a = 1; return static_cast<T!>(a); } === cut here === This patch makes *_cast<*> parsing more robust by skipping to the closing '>' upon error in the target type. Successfully tested on x86_64-pc-linux-gnu. PR c++/108438 gcc/cp/ChangeLog: * parser.cc (cp_parser_postfix_expression): Use cp_parser_require_end_of_template_parameter_list to skip to the closing '>' upon error parsing the target type of *_cast<*> expressions. gcc/testsuite/ChangeLog: * g++.dg/parse/crash75.C: New test.