[Bug c++/94480] [10 Regression] ICE in cp_parser_abort_tentative_parse, at cp/parser.c:31858

ppalka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 7 19:23:34 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94480

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|ppalka at gcc dot gnu.org          |unassigned at gcc dot gnu.org
             Status|ASSIGNED                    |NEW

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Reduced rejects-valid testcase:

  decltype(requires { 1; }) b;



This is probably caused by commit 3ec8ee2e0f0b0508ca9dcc7b99f8e79015efd600 on
the concepts branch:

commit 3ec8ee2e0f0b0508ca9dcc7b99f8e79015efd600
Date:   Fri Jul 12 17:04:02 2019 -0400

      * parser.c (cp_parser_requires_expression): Commit to the tentative
parse.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 9e6cad6ce91..ea24fe1da6b 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -27203,6 +27203,9 @@ cp_parser_requires_expression (cp_parser *parser)
       return error_mark_node;
     }

+  /* This is definitely a requires-expression.  */
+  cp_parser_commit_to_tentative_parse (parser);
+
   tree parms, reqs;
   {
     /* Local parameters are delared as variables within the scope


Or at least, removing this call fixes the ICE, and doesn't seem to introduce
any testsuite regressions.  I wonder what we need this call to
cp_parser_commit_to_tentative_parse for?  I ran a bunch of frontend/library
testsuite tests with the above call replaced with a 

  gcc_assert (!cp_parser_uncommitted_to_tentative_parse_p (parser));

and I couldn't get the assert to fail in any of the existing testsuite tests I
tried.  The assert of course fails for the testcase in this PR though.

Unassigning myself since I don't think I understand the tentative parsing stuff
here enough to resolve this.


More information about the Gcc-bugs mailing list