[clang] [clang] Fix crashes when initializing constexpr int* with floating-point (PR #180376)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 9 04:39:48 PST 2026
================
@@ -8503,8 +8503,12 @@ ExprResult InitializationSequence::Perform(Sema &S,
Expr::EvalResult ER;
if (Entity.getType()->getAs<PointerType>() &&
CurInit.get()->EvaluateAsRValue(ER, S.Context) &&
- !ER.Val.isNullPointer()) {
+ // We continue and let it error later if Rvalue is not a pointer
+ ER.Val.isLValue() &&
+ !ER.Val.isNullPointer() &&
+ !ER.Val.getLValueBase().isNull()) {
----------------
Fznamznon wrote:
Why do we need both checks? i.e. `ER.Val.isNullPointer()` AND `ER.Val.getLValueBase().isNull()`
https://github.com/llvm/llvm-project/pull/180376
More information about the cfe-commits
mailing list