================ @@ -2363,8 +2356,11 @@ void InitListChecker::CheckStructUnionTypes( } // Emit warnings for missing struct field initializers. - if (!VerifyOnly && InitializedSomething && CheckForMissingFields && - !RD->isUnion()) { + // This check is disabled for designated initializers in C. + // This matches gcc behaviour. + if (!VerifyOnly && InitializedSomething && !RD->isUnion() && + !IList->isIdiomaticZeroInitializer(SemaRef.getLangOpts()) && + !(HasDesignatedInit && !SemaRef.getLangOpts().CPlusPlus)) { ---------------- vvd170501 wrote:
Unexpanded condition corresponds to the comment I left a few lines above: > This check is disabled for designated initializers in C. For me personally, it looks a bit less readable in expanded form ("check unused fields if there are no designated initializers or if language is C++") https://github.com/llvm/llvm-project/pull/81364 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits