[clang] [clang-tools-extra] [llvm] [clang] Fix false positive -Wmissing-field-initializer for anonymous unions (PR #70829)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 6 13:55:25 PST 2023


================
@@ -727,6 +729,44 @@ void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field,
     if (hadError || VerifyOnly) {
       // Do nothing
     } else if (Init < NumInits) {
----------------
zygoloid wrote:

Is it OK that we don't warn on the `else` case here? Do we still warn for:

```c++
struct A { int x, y; };
A a = {.x = 1}; // missing `.y` initializer
```

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


More information about the cfe-commits mailing list