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

mcccs at gmx dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery

--- Comment #4 from mcccs at gmx dot com ---
In the commit which introduced this problem, this line looked like recursion to
me:

16037         if ((cxx_dialect > cxx17)
16038             && (TREE_CODE (templ) == FUNCTION_DECL || identifier_p
(templ))
16039             && !template_keyword_p
16040             && (cp_parser_error_occurred (parser)
16041                 || cp_lexer_next_token_is_not (parser->lexer,
CPP_OPEN_PAREN)))
16042           {
16043             /* This didn't go well.  */
16044             if (TREE_CODE (templ) == FUNCTION_DECL)
16045               {
16046                 /* C++2A says that "function-name < a;" is now
ill-formed.  */
16047                 if (cp_parser_error_occurred (parser))
16048                   {
16049                     error_at (token->location, "invalid
template-argument-list");
16050                     inform (token->location, "function name as the left
hand "
16051                             "operand of %<<%> is ill-formed in C++2a;
wrap the "
16052                             "function name in %<()%>");
16053                   }
16054                 else
16055                   /* We expect "f<targs>" to be followed by "(args)".  */
16056                   error_at (cp_lexer_peek_token
(parser->lexer)->location,
16057                             "expected %<(%> after
template-argument-list");
16058                 if (start_of_id)
16059                   /* Purge all subsequent tokens.  */
16060                   cp_lexer_purge_tokens_after (parser->lexer,
start_of_id);
16061               }
16062             else
16063               cp_parser_simulate_error (parser); <---------------------
16064             pop_deferring_access_checks ();
16065             return error_mark_node;
16066           }

so I replaced it with:

        else {
                error_at (token->location, "branch run");
                cp_parser_simulate_error (parser);
        }

and counted the number of times "branch run" was printed for each source:

// a < b: 8
// a < b < c: 96 (x12)
// a < b < c < d: 1104 (x11.5)
// a < b < c < d < e: 12672 (x11.4782608696)
// a < b < c < d < e < f: 145440 (x11.4772727273)

(This is a low priority issue, the only benefit would be to able to debug
pr118526 and protect online compilers from DoS)

Reply via email to