[clang] [Clang] Fixed an assertion in constant evaluation of EmbedExpr inside array initializers. (PR #182257)

Aadarsh Keshri via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 20 03:27:52 PST 2026


================
@@ -14770,15 +14770,16 @@ bool ArrayExprEvaluator::VisitCXXParenListOrInitListExpr(
         Value = SL->getCodeUnit(I);
         if (DestTy->isIntegerType()) {
           Result.getArrayInitializedElt(ArrayIndex) = APValue(Value);
-        } else {
-          assert(DestTy->isFloatingType() && "unexpected type");
+        } else if (DestTy->isRealFloatingType()) {
           const FPOptions FPO =
               Init->getFPFeaturesInEffect(Info.Ctx.getLangOpts());
           APFloat FValue(0.0);
           if (!HandleIntToFloatCast(Info, Init, FPO, EmbedS->getType(), Value,
                                     DestTy, FValue))
             return false;
           Result.getArrayInitializedElt(ArrayIndex) = APValue(FValue);
+        } else {
+          return false;
----------------
Aadarsh-Keshri wrote:

@efriedma-quic I'm new to LLVM. Could you please guide me on this part?

https://github.com/llvm/llvm-project/pull/182257


More information about the cfe-commits mailing list