https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71946
Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |paolo.carlini at oracle dot com Assignee|unassigned at gcc dot gnu.org |paolo.carlini at oracle dot com --- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> --- I believe Andrew is right, it's just matter of setting the flag. The below passes all my tests so far: Index: parser.c =================================================================== --- parser.c (revision 253396) +++ parser.c (working copy) @@ -10557,6 +10557,7 @@ cp_parser_lambda_body (cp_parser* parser, tree lam { bool nested = (current_function_decl != NULL_TREE); bool local_variables_forbidden_p = parser->local_variables_forbidden_p; + bool in_function_body = parser->in_function_body; if (nested) push_function_context (); else @@ -10567,6 +10568,7 @@ cp_parser_lambda_body (cp_parser* parser, tree lam save_omp_privatization_clauses (omp_privatization_save); /* Clear this in case we're in the middle of a default argument. */ parser->local_variables_forbidden_p = false; + parser->in_function_body = true; /* Finish the function call operator - class_specifier @@ -10653,6 +10655,7 @@ cp_parser_lambda_body (cp_parser* parser, tree lam restore_omp_privatization_clauses (omp_privatization_save); parser->local_variables_forbidden_p = local_variables_forbidden_p; + parser->in_function_body = in_function_body; if (nested) pop_function_context(); else