[clang] [clang] Implement constexpr heap allocation alignments (PR #174549)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 25 10:57:16 PDT 2026


================
@@ -10569,6 +10663,8 @@ static CharUnits getBaseAlignment(EvalInfo &Info, const LValue &Value) {
     return Info.Ctx.getDeclAlign(VD);
   if (const auto *E = Value.Base.dyn_cast<const Expr *>())
     return GetAlignOfExpr(Info.Ctx, E, UETT_AlignOf);
+  if (const auto &DA = Value.Base.dyn_cast<DynamicAllocLValue>())
+    return Info.Ctx.toCharUnitsFromBits(DA.getAlign());
----------------
efriedma-quic wrote:

Oh, nevermind, we store the type.  That just isn't quite enough here because we don't record the DynAllocKind.

Maybe we should store the DynAllocKind instead the alignment?

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


More information about the cfe-commits mailing list