<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/91605>91605</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] `readability-redundant-member-init` warning when non-redudant
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
coryan
</td>
</tr>
</table>
<pre>
This code triggers the `readability-redundant-member-init` warning, it seems to me that this is anything but redundant:
```cc
#include <string>
#include <optional>
struct F1 {
std::optional<std::string> a = std::string{};
};
```
https://godbolt.org/z/M9ejhTTaf
Changing the `std::string{}` to `std::string{""}` makes the warning go away:
```cc
#include <string>
#include <optional>
struct F1 {
std::optional<std::string> a = std::string{""};
};
```
https://godbolt.org/z/b4hr9qd6E
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEU8tu4zoM_Rp5QyRQ5Fe88KJN6t3d9Qdoi7XUK0sdiZ4i8_UDJWnaKboZzAADCLTBxzkkD4gp2dkT9aK-F_WxwJVNiP0U4gl9MQZ96h-NTTAFTcDRzjPFBGwIRCMjocbROsunTSS9eo2eNwstI8WN9ZZFI-EVo7d-FuoAliERLQk4wELABhk4o9sE6E9srJ9hXBluYKK8E_Io5Jtt5OVN09WhSusnt2oCUR4Sx8xUPnwVDC9sg0f3Hj7bxHGdGIYdiPb-4oLEOhOXd-81h5vvRgIIojzC50B7L9qjKK9Yv_y_df-R3zC_pAygBqGGOegxON6GOAs1_BBq-K-jZ_P4iE8fiw4G_ZyXdRXi6x4amRf9dVip_C5JC_5PF02vWsEcAF_x9G-2D_DHAtym-2syjJWJ3TfdPBS6L3VXdlhQv2t3tWraupWF6SXRk96XUtaN7FTTVrKm_b7ba9W1E5IsbK-kqmQtu129U1W3le1IiGqsKyybdqpEJWlB67bOfV8yd2FTWqnvdo2sC4cjuXS-U6Umh37esNWnPGh9LGKfizbjOidRSWcTp3cYtuzOF_6hrD7-7gXDqyEPPvhzZk4s1uj6T5uzbNZxO4VFqCE3cP1sXmJ4pomFGs5DJaGG81w_AwAA__8x8lgh">