Skip to content

Commit 8a00185

Browse files
committed
[clang][bytecode] Address review comments by added more code comments and use Invalid()
Signed-off-by: yronglin <[email protected]>
1 parent e60b9d7 commit 8a00185

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,12 @@ bool CheckConstant(InterpState &S, CodePtr OpPC, const Descriptor *Desc) {
348348
if (D->isConstexpr())
349349
return true;
350350

351+
// If we're evaluating the initializer for a constexpr variable in C23, we may
352+
// only read other contexpr variables. Abort here since this one isn't
353+
// constexpr.
351354
if (const auto *VD = dyn_cast_if_present<VarDecl>(S.EvaluatingDecl);
352-
VD && VD->isConstexpr() && S.getLangOpts().C23) {
353-
S.FFDiag(S.Current->getExpr(OpPC));
354-
return false;
355-
}
355+
VD && VD->isConstexpr() && S.getLangOpts().C23)
356+
return Invalid(S, OpPC);
356357

357358
QualType T = D->getType();
358359
bool IsConstant = T.isConstant(S.getASTContext());

0 commit comments

Comments
 (0)