@@ -13237,9 +13237,13 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr,
13237
13237
current_class_ref = view_as_const (current_class_ref_copy);
13238
13238
13239
13239
/* Parse the condition. */
13240
+ begin_scope (sk_contract, current_function_decl);
13240
13241
++processing_contract_condition;
13242
+ processing_postcondition = false;
13243
+ should_constify_contract = should_constify;
13241
13244
cp_expr condition = cp_parser_conditional_expression (parser);
13242
13245
--processing_contract_condition;
13246
+ pop_bindings_and_leave_scope ();
13243
13247
13244
13248
/* Revert (any) constification of the current class object. */
13245
13249
current_class_ref = current_class_ref_copy;
@@ -31524,16 +31528,20 @@ cp_parser_contract_attribute_spec (cp_parser *parser, tree attribute,
31524
31528
31525
31529
/* Parse the condition, ensuring that parameters or the return variable
31526
31530
aren't flagged for use outside the body of a function. */
31531
+ begin_scope (sk_contract, current_function_decl);
31527
31532
++processing_contract_condition;
31528
31533
if (postcondition_p)
31529
31534
++processing_contract_postcondition;
31535
+ processing_postcondition = postcondition_p;
31536
+ should_constify_contract = should_constify;
31530
31537
cp_expr condition = cp_parser_conditional_expression (parser);
31531
31538
if (postcondition_p)
31532
31539
--processing_contract_postcondition;
31540
+ --processing_contract_condition;
31541
+ pop_bindings_and_leave_scope ();
31533
31542
/* Revert (any) constification of the current class object. */
31534
31543
current_class_ref = current_class_ref_copy;
31535
31544
flag_contracts_nonattr_noconst = old_flag_contracts_nonattr_noconst;
31536
- --processing_contract_condition;
31537
31545
31538
31546
/* For natural syntax, we eat the parens here. For the attribute
31539
31547
syntax, it will be done one level up, we just need to skip to it. */
@@ -31643,13 +31651,15 @@ void cp_parser_late_contract_condition (cp_parser *parser,
31643
31651
31644
31652
/* Parse the condition, ensuring that parameters or the return variable
31645
31653
aren't flagged for use outside the body of a function. */
31654
+ begin_scope (sk_contract, fn);
31646
31655
++processing_contract_condition;
31647
31656
if (POSTCONDITION_P (contract))
31648
31657
++processing_contract_postcondition;
31649
31658
condition = cp_parser_conditional_expression (parser);
31650
31659
if (POSTCONDITION_P (contract))
31651
31660
--processing_contract_postcondition;
31652
31661
--processing_contract_condition;
31662
+ pop_bindings_and_leave_scope ();
31653
31663
31654
31664
if (cp_lexer_next_token_is_not (parser->lexer, CPP_EOF))
31655
31665
error_at (input_location,
0 commit comments