<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97405>97405</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] False negative readability-redundant-member-init with compiler-generated constructor
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chrchr-github
</td>
</tr>
</table>
<pre>
~~~c++
struct S1 {
int a{}, b{};
};
struct S2 {
int x, y;
S2() : x{}, y{} {}
};
struct T {
S1 s1{};
S2 s2{}; // warning
};
~~~
~~~
[<source>:12:10: warning: initializer for member 's2' is redundant [readability-redundant-member-init]
12 | S2 s2{}; // warning
| ^~
~~~
I would expect warnings also for `s1`.
https://godbolt.org/z/Gbn8YYdnG
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU8Fu4jAQ_ZrJZRTkTAgmhxxoaao9dy89Oo6beGVsZDtt6YFvXzlQulBpdy1ERi8z782beEQIerBKNVDdQbXNxBRH5xs5ejn6fNBxnLqsc_2hOR6PEugu_dgW2CZEP8mITwUCP0OIiNpGFAnhW6B77M5heU65iq946DvPe2I4XPLxiYDWQDVCucH3L5HDKcQz8nehn9c6TwWG4qbJGScMdMERqAVq8U14q-3wXeJ4PN4EaaDlfXCTlwrKByg3BaU_lpr_5Ck3qK2OWhj9oTy-OI87teuURyAeCIijDuhVP9le2IhQ3XkletFpo-Mhv7zIT1V5IoNqe7FRpKne_48ZnE9KvhyoHm5N_cA3N5ke1fteyfjJEFCY4ObuYcVCASu2OOWPMe4DlJuT4uD6zpm4cH4Aaj-A2sfOrp-fe_uY9U3Z12UtMtUUvKjrYrWq62xsGFc1UcnUC2dyyddUM1ZS2fGiellXK8p0Q4yWjDMqWLku6kXRk5BcyIp3a847BUumdkKbhTGvu6Sd6RAm1dR8yarMiE6ZMF9_ImmEHfKo-wMQpXXwTSrKu2kIsGRGhxi-aKKOZl6cP8qqLbbCBIVWDSLqV4X__F74puOI0u322iifD8oqL6LqUTp7urPOZ5M3zc0w591cSLcDalNP50e-9-6XkhGonX0GoPZk9bWh3wEAAP__l3MkoQ">