Skip to content

Commit 5104a33

Browse files
committed
use immediately-invoked lambda expression
1 parent adf82cf commit 5104a33

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

clang/lib/Parse/ParseExprCXX.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,17 +2203,15 @@ Parser::ParseCXXCondition(StmtResult *InitStmt, SourceLocation Loc,
22032203
return ParseCXXCondition(nullptr, Loc, CK, MissingOK);
22042204
}
22052205

2206-
ExprResult Expr;
2207-
{
2206+
ExprResult Expr = [&] {
22082207
EnterExpressionEvaluationContext Eval(
22092208
Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated,
22102209
/*LambdaContextDecl=*/nullptr,
22112210
/*ExprContext=*/Sema::ExpressionEvaluationContextRecord::EK_Other,
22122211
/*ShouldEnter=*/CK == Sema::ConditionKind::ConstexprIf);
2213-
22142212
// Parse the expression.
2215-
Expr = ParseExpression(); // expression
2216-
}
2213+
return ParseExpression(); // expression
2214+
}();
22172215

22182216
if (Expr.isInvalid())
22192217
return Sema::ConditionError();

0 commit comments

Comments
 (0)