[Bug c++/88754] [8/9/10 Regression] Constructor call wrongly assumed to be a variable declaration
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Apr 17 18:07:59 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88754
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:3f5af3f71195b7f1ebe32bd0d695b59904fff778
commit r10-7779-g3f5af3f71195b7f1ebe32bd0d695b59904fff778
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Apr 16 16:45:15 2020 -0400
c++: Hard error with tentative parse of declaration [PR88754]
In the testcase for this PR, we try to parse the statement
A(value<0>());
first tentatively as a declaration (with a parenthesized declarator), and
during
this tentative parse we end up issuing a hard error from
cp_parser_check_template_parameters about its invalidness as a declaration.
Rather than issuing a hard error, it seems we should instead simulate an
error
since we're parsing tentatively. This would then allow cp_parser_statement
to
recover and successfully parse the statement as an expression-statement
instead.
gcc/cp/ChangeLog:
PR c++/88754
* parser.c (cp_parser_check_template_parameters): Before issuing a
hard
error, first try simulating an error instead.
gcc/testsuite/ChangeLog:
PR c++/88754
* g++.dg/parse/ambig10.C: New test.
More information about the Gcc-bugs
mailing list