[clang] [clang][ExprConst] Support virtual bases in C++26 (PR #204289)

Yihan Wang via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 14 06:59:03 PDT 2026


================
@@ -7170,10 +7282,13 @@ static bool HandleConstructorCall(const Expr *E, const LValue &This,
 
   // Reserve space for the struct members.
   if (!Result.hasValue()) {
-    if (!RD->isUnion())
-      Result = APValue(APValue::UninitStruct(), RD->getNumBases(),
-                       RD->getNumFields());
-    else
+    if (!RD->isUnion()) {
+      unsigned NonVirtualBases =
+          llvm::count_if(RD->bases(), [](auto &B) { return !B.isVirtual(); });
----------------
yronglin wrote:

I see multiple calculations of NonVirtualBase. Can we add a new helper function? 

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


More information about the cfe-commits mailing list