Skip to content

Instantly share code, notes, and snippets.

@a-tarasyuk
Created February 19, 2025 21:25
Show Gist options
  • Save a-tarasyuk/41b2a31bd2ae65f23b68aaeb29677aa3 to your computer and use it in GitHub Desktop.
Save a-tarasyuk/41b2a31bd2ae65f23b68aaeb29677aa3 to your computer and use it in GitHub Desktop.
{
EnterExpressionEvaluationContext Eval(
Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated,
/*LambdaContextDecl=*/
nullptr,
/*ExprContext=*/
Sema::ExpressionEvaluationContextRecord::EK_Other,
/*ShouldEnter=*/
CK == Sema::ConditionKind::ConstexprIf);
// Parse the expression.
Expr = ParseExpression(); // expression
}
if (Expr.isInvalid())
return Sema::ConditionError();
if (InitStmt && Tok.is(tok::semi)) {
WarnOnInit();
* InitStmt = Actions.ActOnExprStmt(Expr.get());
ConsumeToken();
return ParseCXXCondition(nullptr, Loc, CK, MissingOK);
}
return Actions.ActOnCondition(getCurScope(), Loc, Expr.get(), CK,
MissingOK);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment