<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54748>54748</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] cppcoreguidelines-pro-type-member-init check flags union member
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
paulaltin
</td>
</tr>
</table>
<pre>
Running clang-tidy on this code:
```
struct s {
union {
int a = 0;
int b;
};
};
```
results in the following warning:
```
warning: constructor does not initialize these fields: b [cppcoreguidelines-pro-type-member-init]
```
However, adding an initializer to `b` (e.g. `int b = 0`) results in a clang diagnostic:
```
error: initializing multiple members of union [clang-diagnostic-error]
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNUtmu2yAQ_Rr8MrLli53YefBDb6Oqz_0DlrFNS8BiuVH69QU7y41aRUVsw8CZc2bgVl6GH9EYZSYQmpmpDEpewBoIs_IgrETSfCH1kdS3eV9f-2r64KII4IF079sJpBaNShBPR7kpE4ABaY5Qk-YfPv50Srrj3X7aPzPYZoc-6uATTGKOMFqt7TmrOjOX1b1W8biUJJtNk3UgLXowNiRUFRTT6jdmdJ_wFWrp830OZPculkVYh1NUErUy6MvF2TJcFixPeOLoyoxAdscXCr7bM36gI_QrMCkzdWY-BXYQLKQnPA0gtMdqqrK95u2a0wRID_ApFWwrKkjFJmN9UOJ1HtA567Kqe9zM45Tg1KIRNi0e7HircJK-_ppHgHLD-EtqIYdGHpoDK4IKGof70_zh0nX4vxyCmFH8glGzyV9JbN4iOj3MISy5KoR-S31SYY68EvaUDK0_bksG_okiJFN5H9Gnza7t2r6Yh353wLe-rwXuZTe2dGwRu45Rvt8LpLwvNOOofaZPKDV4hhUi7ZOGQg20prRu611amqarZD32oukPXDSC49tI2hpPTOkq86ismwo3rJR4nHxyauWDfziZ92oyuGYr47MYZuuGhUXNUk1MsQYfVvJ_APAIKVM">