@@ -13138,9 +13138,13 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr,
13138
13138
current_class_ref = view_as_const (current_class_ref_copy);
13139
13139
13140
13140
/* Parse the condition. */
13141
+ begin_scope (sk_contract, current_function_decl);
13141
13142
++processing_contract_condition;
13143
+ processing_postcondition = false;
13144
+ should_constify_contract = should_constify;
13142
13145
cp_expr condition = cp_parser_conditional_expression (parser);
13143
13146
--processing_contract_condition;
13147
+ pop_bindings_and_leave_scope ();
13144
13148
13145
13149
/* Revert (any) constification of the current class object. */
13146
13150
current_class_ref = current_class_ref_copy;
@@ -31393,16 +31397,20 @@ cp_parser_contract_attribute_spec (cp_parser *parser, tree attribute,
31393
31397
31394
31398
/* Parse the condition, ensuring that parameters or the return variable
31395
31399
aren't flagged for use outside the body of a function. */
31400
+ begin_scope (sk_contract, current_function_decl);
31396
31401
++processing_contract_condition;
31397
31402
if (postcondition_p)
31398
31403
++processing_contract_postcondition;
31404
+ processing_postcondition = postcondition_p;
31405
+ should_constify_contract = should_constify;
31399
31406
cp_expr condition = cp_parser_conditional_expression (parser);
31400
31407
if (postcondition_p)
31401
31408
--processing_contract_postcondition;
31409
+ --processing_contract_condition;
31410
+ pop_bindings_and_leave_scope ();
31402
31411
/* Revert (any) constification of the current class object. */
31403
31412
current_class_ref = current_class_ref_copy;
31404
31413
flag_contracts_nonattr_noconst = old_flag_contracts_nonattr_noconst;
31405
- --processing_contract_condition;
31406
31414
31407
31415
/* For natural syntax, we eat the parens here. For the attribute
31408
31416
syntax, it will be done one level up, we just need to skip to it. */
@@ -31512,13 +31520,15 @@ void cp_parser_late_contract_condition (cp_parser *parser,
31512
31520
31513
31521
/* Parse the condition, ensuring that parameters or the return variable
31514
31522
aren't flagged for use outside the body of a function. */
31523
+ begin_scope (sk_contract, fn);
31515
31524
++processing_contract_condition;
31516
31525
if (POSTCONDITION_P (contract))
31517
31526
++processing_contract_postcondition;
31518
31527
condition = cp_parser_conditional_expression (parser);
31519
31528
if (POSTCONDITION_P (contract))
31520
31529
--processing_contract_postcondition;
31521
31530
--processing_contract_condition;
31531
+ pop_bindings_and_leave_scope ();
31522
31532
31523
31533
if (cp_lexer_next_token_is_not (parser->lexer, CPP_EOF))
31524
31534
error_at (input_location,
0 commit comments