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

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 05:58:16 PST 2023


mikaelholmen wrote:

Hi again @Fznamznon 
the following also started causing warnings after this patch (also with the fix)
```
struct S3 {
  long int l;
  struct  { int a, b; } d1[2];
};

struct S3 s32 = { .d1[0].a = 1 };
```
We get
```
foo.c:6:30: warning: missing field 'b' initializer [-Wmissing-field-initializers]
    6 | struct S3 s32 = { .d1[0].a = 1 };
      |                              ^
1 warning generated.
```
with this patch.


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


More information about the cfe-commits mailing list