================
@@ -110,10 +112,30 @@ static bool CheckFieldsInitialized(InterpState &S,
SourceLocation Loc,
}
return false;
}
- Result &= CheckFieldsInitialized(S, Loc, P, B.R);
+ Result &= CheckFieldsInitialized(S, Loc, P, B.R, false);
+ }
+
+ if (Toplevel) {
+ for (auto [I, B] : llvm::enumerate(R->virtual_bases())) {
+ PtrView P = BasePtr.atField(B.Offset);
+ if (!P.isInitialized()) {
+ const Descriptor *Desc = BasePtr.getDeclDesc();
+ if (const auto *CD = dyn_cast_if_present<CXXRecordDecl>(R->getDecl()))
{
+ const auto &BS = *std::next(CD->bases_begin(), I);
+ SourceLocation TypeBeginLoc = BS.getBaseTypeLoc();
+ S.FFDiag(TypeBeginLoc, diag::note_constexpr_uninitialized_base)
+ << B.Desc->getType() << SourceRange(TypeBeginLoc,
BS.getEndLoc());
+ } else {
+ S.FFDiag(Desc->getLocation(),
diag::note_constexpr_uninitialized_base)
+ << B.Desc->getType();
+ }
+ return false;
+ }
+
+ Result &= CheckFieldsInitialized(S, Loc, P, B.R, false);
----------------
Sirraide wrote:
Can you factor (some of) this out into a lambda instead of duplicating it from
above?
https://github.com/llvm/llvm-project/pull/204289
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits