<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70384>70384</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[18 regression] false positive `-Wmissing-field-initializer` warning for anonymous union with default member initializer
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zygoloid
</td>
</tr>
</table>
<pre>
This code:
```c++
struct A {
int m;
union { int n = 0; };
};
A a = A{.m = 0};
```
produces this false-positive warning:
```console
<source>:6:15: warning: missing field 'A::(anonymous union at <source>:3:5)' initializer [-Wmissing-field-initializers]
6 | A a = A{.m = 0};
| ^
```
It looks like this regressed in https://reviews.llvm.org/D157879 / 91088978d712cd7b33610c59f69d87d5a39e3113.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU8GOozgQ_ZriUkpk7BjjAwcymUh7X2nPgAviHWNHtumo5-tXkHR3utXaQZaBqleles_PXUp28kQNyCPIU9Et-RJi8_t1Ci5YU_TBvDZ_X2zCIRgC0QI7AWuhYvc1AD-ua4umHJchY4ugHhFEROszziCeIou3wa-gLecRxAkZiCOCOr0DP31ve4vdBm1BHffzo-oZ9TbU_fcag1kGSpjX8cfOJdpdQ7LZvhDeuuitn74hFHwKjh5R8SOFJQ4E4ieItgLRlhJE-1SOs03J-glHS84gcNWuTUULvO588K9zWNKDcZfxS0cBopXANXCF1ttsO2d_U0SQx90_j867rfPuKZ1Anj7UrBDUD_yTOLg9KxLkz2_1uu9_ZXQh_Ero7C-6SxdpipQSGbQeLzlf00bvDPwc6cXSLe2de5n3IU7Az6dSqlppBH5GXbK61qo2quSDUb0QVckGqcdKm1oZ2QlNoizFvjCNMFrorqCmrHQtpOKaF5dGCNUfzCg5l6XuiOmDNiMXoyRdaX3ghW0446JkvOKlPEi-N6XWmvdaK60FsREOjObOuvcZC5vSQo1ioj4UruvJpc39nHu64ZYEztfLEJu1ZtcvU4IDczblD6ZFttlt16as3xSywYM83a2G71aDiv3PWULF3tyEY4j41TM3my9oaOwWl3Gmuaf47JRiia75fCaTzZel3w9hBn5ex328dtcY_qUhAz9vJBPw8ybCfwEAAP__M6UuHg">