<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/81001>81001</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] New check: Prefer list initialization
</td>
</tr>
<tr>
<th>Labels</th>
<td>
enhancement,
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
SunBlack
</td>
</tr>
</table>
<pre>
We are currently still using round brackets instead of curly brackets to create instances in our project. The transition within the member initialization lists to list initialization already showed some type issues.
As showed e.g., [here](https://stackoverflow.com/a/18222927) I think there are good reasons to prefer list initialization. Sadly it is not possible to refactor a project just with regular expressions, as there are some exceptions.
So my suggestion is to:
- Add a check `modernize-use-list-initialization` (ways thinking also about `bugprone` category, but not sure which is better)
- Suggest list initialization on all objects, which doesn't implement a initialization list constructor (e.g., `std::vector` should not transformed to an initializer list).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0lMGO4ygQhp8GX0qxMG4n8cGH9ESR9rJaqVfaM4aKzQSDRUFnPE-_gnRvT696LrblKoq_Pv5CEpnJIQ6se2bduZIpzj4ML8k9W6lu1ej1NvyDIAOCSiGgi3YDisZaSGTcBMEnp2EMUt0wEhhHEaUGf835dvuIRA8qoIxYcqRTmLPBpwBr8N9RxRr-nhFikI5MNN7B3cTZOIgzwoLLiAGMM9FIa37KkmANPSrnj_8HpQ0o9QY0-ztqIL8gxG1FMEQJqWb8zPjp8TzRexrWU83EN2Dd84wBWXdm4jjHuBJrT0xcmLhQlOrmXzFcrb_Xyi9MXCQTl-YohOjFgYke_oAs_Za1hwe-yXsNASV5VySvAa8YvlJew4vUdgMTwRA4H2H1RGa0mNcFvEoVfQD5zg2-J4oFFgSckpUB8McakMh4R7kZSb8IKSDwh8I1b_aZw4uHZQNK04RUIJqsNXdewjs4aQ0S1IzqBmzPF68xOPMTd4lwl3vZfe6F7TkwcbzLjR5EsmekJQ9y9CnmGmOa1uAd5lQlI04-bFn0mGJpnlJAuM9GzVnNiDFiYKJ_V_TyEPulBYoLLPgxYyokHnW0R3JMHCKYZbW4oIsgvzIXKO8ohlSAM3H8zx17TlFnLu3pFXM0q6fZJ6uL6OLiqw8L6nxo0n1Ufzt0Jvq60kOr-7aXFQ7NgR_apu86Uc0DP3Ya96pp1LHl3f7AG37sVXft93vetFdZmUFw8cQFPzSd6LqmPjSCi33L5dPhSTbYsCeOizS2tvZ1qX2YqmL74dhw3lRWjmipTL0Q6OY8jpkCE4KJb0wIZaWbdtHoLf_qzlUYcqHdmCZiT7wM3kfpaKItd8gvy7oz_In3h1VYe4K_fuv3KgU7fB6xycQ5jW-zlbd5e-3eLM_E5THFTFxKR_8GAAD__w_JoVw">