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 <ppa...@gcc.gnu.org>:

https://gcc.gnu.org/g:3f5af3f71195b7f1ebe32bd0d695b59904fff778

commit r10-7779-g3f5af3f71195b7f1ebe32bd0d695b59904fff778
Author: Patrick Palka <ppa...@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.

Reply via email to