<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/132260>132260</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] False positive for modernize-avoid-c-arrays in smart pointers and their make functions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kuzi117
</td>
</tr>
</table>
<pre>
Clangd version: 19.1.2
Using the `T[]` specialization for `make_unique`/`make_unique_for_overwrite` and the resulting unique_ptr, clang-tidy reports that the template parameter should be replaced with `std::array`.
Example:
```
std::unique_ptr<T[]> W = std::make_unique<T[]>(n);
std::unique_ptr<T[]> X = std::make_unique_for_overwrite<T[]>(n);
std::shared_ptr<T[]> Y = std::make_shared<T[]>(n);
std::shared_ptr<T[]> Z = std::make_shared_for_overwrite<T[]>(n);
```
Every instance of `T[]` in the example is flagged as violating cppcoreguidelines-avoid-c-arrays/modernize-avoid-c-arrays and suggests using `std::array instead`, which doesn't seem feasible in the context.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVF1v4zYQ_DXUy8IGRcn2-UEPviT-BS368RKsxZW0PYpUuZRzzq8vKOcaN2mAAAcYMCDOzs4uh4Mi3HuiRm2-qs19gXMaQmy-zc9clrviFOyluXPoewtnisLBq-oA5X5dro3SB6UPvwr7HtJAoLb6lyuN2mqQiVpGx8-YOHjoQsyAEb_R4-z575nUVitz_O-3xy7Ex3Cm-BQ5ZQSgtwt5JJldyq1ekFOKytxBm8WtEtsLRJpCTAJpwLTUJBonh4lgwogjJYogQ5idhVMmnBy2ZOGJ05ClSbKqOqjqgDHiRW31-jrgw3ccJ0f5TB-y6OtPHwD-LbnRVN39WEL1AL-Bqu5fYbfT3-KU-eKV2avq6-dof_-Q9s0CP9NEBoxk3zf543-aXLE_Rfvnh7Sf1X57Bw9nihdgLwl9SxC6Ny5kvziBrncILNA57HuygAJnDg4XT7XT1IZI_cyWHHuSFZ4D21W7WswgyhzHYCl6fqY3R4tDZe57kiQwL6_hnZsWhYR28fwdPA3cDmADiVdml0CIRugIhU9Z5FVzG3yi72ld2Kay-2qPBTXlrjb13tTaFEOz21e46UxL3WmzQ1NTaW257b502xK1bauCG6PNRldGl7taa7OmeqdN2xqsT11X2lrVmkZkt3buPK5D7AsWmakpK2O2unB4IidLNBjz-tCUMTkqYpOrVqe5F1Vrx5LklSdxckuo3JRt7uGITgimIJz4TEsofLhX9iAjxgRTYJ8oyo8s4AjZNdDNvs3ZIsUcXTOkNEleuTkqc-w5DfNp3YZRmWNW9fK3mmL4i9qkzHEZNd_sy7TnxvwTAAD__z_Fm2w">