Skip to content

Commit 206e0f6

Browse files
committed
c++, contracts: Recognise contract check scope for lambdas.
This allows lambdas to have default captures in the scope of contract pre/post-conditions. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
1 parent 05e1e1d commit 206e0f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gcc/cp/parser.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11815,7 +11815,9 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)
1181511815
cp_lexer_consume_token (parser->lexer);
1181611816
first = false;
1181711817

11818-
if (!(at_function_scope_p () || parsing_nsdmi ()))
11818+
if (!(at_function_scope_p ()
11819+
|| parsing_nsdmi ()
11820+
|| current_binding_level->kind == sk_contract))
1181911821
error ("non-local lambda expression cannot have a capture-default");
1182011822
}
1182111823

0 commit comments

Comments
 (0)