<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/131599>131599</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] False positive misc-const-correctness with double pointers
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy,
false-positive
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
carlosgalvezp
</td>
</tr>
</table>
<pre>
Consider this code frequently found when interacting with C API:
```cpp
void foo(void**);
void bar()
{
void* ptr{};
foo(&ptr);
}
```
Here, clang-tidy wants `ptr` to be `void const* ptr` , i.e. pointing to `const void`. This change makes the program no longer compile.
https://godbolt.org/z/GrPYf7Gao
The warning goes away if I remove the braces initializing `ptr`. But as a user I should be able to do that anyway (some other guidelines require this).
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcU0-PuzgM_TThYhVB-NceOHRaMTu3OcxljwYMZDfEbBJadT79KtD5o59kqcV5frZfXtA5NRqiWhQvorhGuPqJbd2h1exG1Df6XKKW-0d9YeNUTxb8pBx03BMMlv5byXj9gIFX08N9IgPKeLLYeWVGuCs_wQXO728iO4tkizLZo1sWkZxvrHoYmIU8hr9Cnrc4iexlx2-AFq2Qx5BOzqIKJwAAzwJYvA3J6roXPemELMPBN1V1_d19J_-LLAl5gU6jGQ9e9Q-4o_EORJmE4jIBz9BS-N4G6dg4_9WzTCAUq5hiWFiZbWXPAbzh9gHLJIaPTbMJzUgw47_kwE8Ei-XR4gyGQbMZyULH86I0xft0k_eLC8LJRshm5L5l7WO2o5DNp5DNq33_e6hekXf4x0RwR2vCFCOTA7zjA9QAb2Bp5httTVuLHTlQRnmFWn0G9Pe2MbysHtABwurIwhu4iVfdBwmw1RS26xn8hB7QPAK_kEfHMwH7iSyMq-pJK0MOgjmUpc0vQp7iqK-z_pSdMKI6rXIpk-qUZdFU522R5flQpV2HWUmYDZgeKR0KmeeYYhWpWiaySLK0SpPsWGQxJn2JbZXlObZHWZDIE5pR6Vjr2xwEipRzK9VplhanU6SxJe02i0v5c9VCSiEvQsoBtaPDwk55daOQLq6RrQPZoV1HJ_JEK-fdD71XXm9v5hdbcYUmEMEXEczKdYfNCYeOraXOG3JufxQ9r0HPzTZkXbRaXf9x38pPaxt3PAvZhM7Pn8Ni-R_qvJDNtqUTsnkueqvl_wEAAP__zpw4OA">