<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/119094>119094</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-tidy's readability-redundant-member-init has false positives for aggregates
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
foonathan
</td>
</tr>
</table>
<pre>
The following code generates a clang-tidy warning for `readability-redundant-member-init`.
```cpp
struct foo {
std::string a;
std::string b = {};
};
```
However, the initializer for `b` is not redundant. Consider:
```cpp
void expect_foo(const foo& f);
expect_foo({"hello"});
```
With the initializer for `b` present, the code is fine. Without the initializer, the code generates a `missing-field-initializer` warning.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEUtuK3DoQ_Br5pbGR5es8-GF2h-F8wIE8Btlq2x00klHLs9l8fdDszl5CLiCwQVXqqq7SzLQ4xEE0D6I5ZXqPqw_D7L3TcdUuG715Hv5fEWZvrX8it8DkDcKCDoOOyKBhstoteSTzDE86uISZfQDRyoDa6JEsxec8oNmd0S7mF7yMGHJyFEUrCyGP6bTy5UzbJuSRY9inCLP3ILoHIY8AAByNqI6iSrdpihbVn65GAFGdbtzu9AJ7_7mPepn8n3_CKwahHiGuCEkWaUs_MNxtjKKVQAzOR3izUcCjd0wGQxr8Ow9XTwbw-4ZT_Dp7L1Q_ecc3U0K1MAt1eBUkj59gSbVSK1rrhVJJ9xvys_QvFNe_it4CMrp493aLjhhmclhAYvs9_vrAJ_DHnEUrL8RMbslnQmvyj6RW3sMvMjNU5lAddIZD2VVVK5uy7rN1MK3pp7mZtOlbNY2dbGTbopn7XkrUU5fRoKSqSyU7JZuD7AvTYdP1aMpa96aqS1FLvGiyhbXXS-HDkhHzjkNZHuShzqwe0fKtzEq91zItsTllYUisfNwXFrW0xJHf34kULQ4fOR3DP_sLq2aYtWWEzTNFuiLfAtDLEnBJi8v2YIc1xo1TT9RZqPNCcd3HYvIXoc5Jwesn34L_hlMU6nyzxUKdX51dB_UzAAD__wrxKuM">