[clang] [clang][CodeGen] Fix zero initialization of virtual bases in delegating constructors (PR #235011)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 5 09:46:53 PST 2026


================
@@ -633,6 +633,12 @@ void CodeGenFunction::EmitCXXConstructExpr(const CXXConstructExpr *E,
   if (E->requiresZeroInitialization() && !Dest.isZeroed()) {
     switch (E->getConstructionKind()) {
     case CXXConstructionKind::Delegating:
+      if (CurGD.getCtorType() == Ctor_Base)
----------------
efriedma-quic wrote:

Can we refactor this to something like `if (E->getConstructionKind() == CXXConstructionKind::Complete || (E->getConstructionKind() == CXXConstructionKind::Delegating && CurGD.getCtorType() != Ctor_Base)`?

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


More information about the cfe-commits mailing list