https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91416
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This patch seems to fix the problem. It follows cp_parser_lambda_body in its
handling of function_depth.
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -28934,6 +28934,8 @@ cp_parser_late_parsing_for_member (cp_parser* parser,
tree member_function)
function_scope = current_function_decl;
if (function_scope)
push_function_context ();
+ else
+ ++function_depth;
/* Push the body of the function onto the lexer stack. */
cp_parser_push_lexer_for_tokens (parser, tokens);
@@ -28966,6 +28968,9 @@ cp_parser_late_parsing_for_member (cp_parser* parser,
tree member_function)
/* Leave the scope of the containing function. */
if (function_scope)
pop_function_context ();
+ else
+ --function_depth;
+
cp_parser_pop_lexer (parser);
}
More tomorrow...