@@ -4421,13 +4421,6 @@ StmtResult Parser::ParseFunctionContractSpecifier(Declarator &DeclaratorInfo) {
44214421 ParsedAttributes CXX11Attrs (AttrFactory);
44224422 MaybeParseCXX11Attributes (CXX11Attrs);
44234423
4424- using ExpressionKind =
4425- Sema::ExpressionEvaluationContextRecord::ExpressionKind;
4426- EnterExpressionEvaluationContext EC (
4427- Actions, Sema::ExpressionEvaluationContext::PotentiallyEvaluated, nullptr ,
4428- ExpressionKind::EK_ContractStmt);
4429- Actions.currentEvaluationContext ().InContractStatement = true ;
4430-
44314424 if (Tok.isNot (tok::l_paren)) {
44324425 Diag (Tok, diag::err_expected_lparen_after) << CKStr;
44334426 SkipUntil ({tok::equal, tok::l_brace, tok::arrow, tok::kw_try, tok::comma,
@@ -4449,8 +4442,12 @@ StmtResult Parser::ParseFunctionContractSpecifier(Declarator &DeclaratorInfo) {
44494442 Scope::FunctionPrototypeScope |
44504443 Scope::ContractAssertScope);
44514444
4445+ EnterExpressionEvaluationContext EC (
4446+ Actions, Sema::ExpressionEvaluationContext::PotentiallyEvaluated);
4447+
44524448 std::optional<Sema::CXXThisScopeRAII> ThisScope;
44534449 InitCXXThisScopeForDeclaratorIfRelevant (DeclaratorInfo, DeclaratorInfo.getDeclSpec (), ThisScope);
4450+ Sema::ContractScopeRAII ContractExpressionScope (Actions);
44544451
44554452 DeclaratorChunk::FunctionTypeInfo FTI = DeclaratorInfo.getFunctionTypeInfo ();
44564453
0 commit comments