[PATCH] D131874: [Clang] Tighten restrictions on enum out of range diagnostic to avoid constant initialization
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 17 05:32:50 PDT 2022
aaron.ballman added a comment.
Precommit CI failures are unrelated to this patch.
================
Comment at: clang/lib/AST/ExprConstant.cpp:13547-13550
+ if (const auto *VD = dyn_cast_or_null<VarDecl>(Info.EvaluatingDecl.dyn_cast<const ValueDecl *>())) {
+ if (VD && !VD->isConstexpr())
+ ConstexprVar = false;
+ }
----------------
You already know that `VD` is nonnull, so no need for that check, and we can remove the predicate entirely because you're setting `ConstexprVar` based on `isConstexpr()` anyway.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131874/new/
https://reviews.llvm.org/D131874
More information about the cfe-commits
mailing list