aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-12-01 13:30:25 +0100
committerMartin Liska <mliska@suse.cz>2021-12-01 13:30:25 +0100
commit4cba2fa027afd5f815bd9bf3965afe1972c7387c (patch)
treeefa05b4ca35e93c65eb1a2585d5ad3dd2dd3db32 /gcc/cp/parser.c
parent789b80d1fbd0b1d516b389bf11b5c70aa4d1088b (diff)
parentd376b73aa12d183e3040456c7641fb74500d0727 (diff)
downloadgcc-4cba2fa027afd5f815bd9bf3965afe1972c7387c.zip
gcc-4cba2fa027afd5f815bd9bf3965afe1972c7387c.tar.gz
gcc-4cba2fa027afd5f815bd9bf3965afe1972c7387c.tar.bz2
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c12
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,