]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: -Wtemplate-body and tentative parsing [PR120575]
authorJason Merrill <jason@redhat.com>
Fri, 4 Jul 2025 09:15:00 +0000 (05:15 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 4 Jul 2025 13:48:01 +0000 (09:48 -0400)
commit35d6f55f7d6655a8683b45286283d44674fa997e
treec29a83531e77245b6097378e08bb255a2bc5434c
parent2f19d9408477829ab7de465310fa0068be0f43ff
c++: -Wtemplate-body and tentative parsing [PR120575]

Here we were asserting non-zero errorcount, which is not the case if the
parse error was reduced to a warning (or silenced) in a template body.  So
check seen_error instead.

PR c++/120575
PR c++/116064

gcc/cp/ChangeLog:

* parser.cc (cp_parser_abort_tentative_parse): Check seen_error
instead of errorcount.

gcc/testsuite/ChangeLog:

* g++.dg/template/permissive-error3.C: New test.
gcc/cp/parser.cc
gcc/testsuite/g++.dg/template/permissive-error3.C [new file with mode: 0644]