diff options
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0bd5852..55e6a1a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -7892,10 +7892,6 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, return postfix_expression; } } - - /* We should never get here. */ - gcc_unreachable (); - return error_mark_node; } /* Helper function for cp_parser_parenthesized_expression_list and @@ -11184,10 +11180,12 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) if (cp_lexer_next_token_is_keyword (parser->lexer, RID_THIS)) { location_t loc = cp_lexer_peek_token (parser->lexer)->location; - if (cxx_dialect < cxx20 + if (cxx_dialect < cxx20 && pedantic && LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda_expr) == CPLD_COPY) - pedwarn (loc, 0, "explicit by-copy capture of %<this%> redundant " - "with by-copy capture default"); + pedwarn (loc, OPT_Wc__20_extensions, + "explicit by-copy capture of %<this%> " + "with by-copy capture default only available with " + "%<-std=c++20%> or %<-std=gnu++20%>"); cp_lexer_consume_token (parser->lexer); if (LAMBDA_EXPR_THIS_CAPTURE (lambda_expr)) pedwarn (input_location, 0, |