<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/80862>80862</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang-Tidy] Create readability-unambiguous-optional-assigment check
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy,
check-request
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
PiotrZSL
</td>
</tr>
</table>
<pre>
I'm adding this here so, i wouldn't forget. Check name to negotiation.
```
std::optional<int> opt;
...
opt = {};
opt = std::optional<int>();
```
Problem with above, is that it's not so straightforward. I run into issue when developer initialized optional with `= std::optional<...>()` and were thinking that optional is actually set.
In std::optional we got very nice methods called `reset` and `emplace`. I would argue that they should be used instead of above examples. Even `std::nullopt` is better.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0U02PszYQ_jXmMgpyzFdy4LCbvJFW6uGV2lNvA56Au8am9pA0_fWVyceqrVZCRgz28zGPB2M0gyNqRfUuqmOGC48-tD-N5_D7r79knde39kOoZgLU2rgBeDQRRgoE0Qt1AANXv1jthGoYzj4MxDkcRuo_weFEwB4cDZ4NsvEuF_Io5NtjreXjWT8ja1G8ieLNz2krWlEcjGNR_AA_syje79vy_AHiZwZRHEE076I5vv4_y9_DCbUTav868B8Z9_Vn8J2lCa6GR8DOX2g1G4FHZDAsVBPBeYboIXJAM4x89uGKQefwAWFxYBx7MDEuBNeRHGi6kPUzBTDOsEFr_iYNT3V3pqTiG-3J90t7LQGdhmvKgUfjPu_RIH_hmQjY84LW3iAS_6vzH-7_FHAlGDzDhcINnOkJJuLR6wg9Wks6aQsUiZ_kopY0zRZ7ErVMpteLABiGhe5aeKQbxHEtdwRLJA3GRSbU4M_3tgL9hdNsKebw40Iuob6kucXaFH0tk5uOmCnkmW4LvS_2mFG7bWSjiqreldnYdrJWuK37si-3VVWqflv2JFWBBW27fb3NTKukKqWS9baWTbXP9bksqgr7slLdrlEkSkkTGptbe5lyH4Zsja_dyV2tMosd2bhOilK9RTds2OibUEqoQyqlS78J9OdCkVO1OmahTVCbbhmiKKU1keMXOBu26-QdVrDfElh1hEMgZIJAqLEz1vBtszicOjMsfombZ16bdXYncgwrc7YE247Mc0zNUyehToPhceny3k9CnRLt47WZg_-DehbqtBqMQp1Wj_8EAAD__zn5SnY">