================ @@ -727,6 +734,38 @@ void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field, if (hadError || VerifyOnly) { // Do nothing } else if (Init < NumInits) { + if (WarnIfMissing) { + auto CheckAnonMember = [&](const FieldDecl *FD, + auto &&CheckAnonMember) -> FieldDecl * { + FieldDecl *Uninitialized = nullptr; + RecordDecl *RD = FD->getType()->getAsRecordDecl(); + assert(RD && "Not anonymous member checked?"); + for (auto *F : RD->fields()) { + if (F->isAnonymousStructOrUnion()) + Uninitialized = CheckAnonMember(F, CheckAnonMember); + else if (!F->isUnnamedBitfield() && + !F->getType()->isIncompleteArrayType() && !Uninitialized && + !F->hasInClassInitializer()) + Uninitialized = F; + + if (RD->isUnion() && (F->hasInClassInitializer() || !Uninitialized)) + return nullptr; + } ---------------- Fznamznon wrote:
Ok, done. Thanks for the catch! https://github.com/llvm/llvm-project/pull/70829 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits