<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62083>62083</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] -Wcast-qual does not trigger on functional casts
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
killerbee13
</td>
</tr>
</table>
<pre>
`-Wcast-qual` does not trigger on the following code in Clang, but does in GCC.
```cpp
const auto i = 42;
using T = int*;
auto p = T(&i);
```
The expected behavior is that a functional cast should trigger the warning the same as the equivalent C cast because the meaning is the same, and nothing about the functional cast makes it easier to recognize that a const_cast is occurring (in fact I would argue it is the opposite) so the same rationale should apply.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsUk9v4y4U_DT48pQI49iNDz60ifLT715pj6sHfrbZEnD5027306_AbVpVK1kGMQxvZjQYgp4t0cDaB9aeK0xxcX540saQl0R1U0k3vg2s47sfCkPcPSc0rOMwOgpgXYTo9TyTB2chLgSTM8a9ajuDciOBtnAyaGcmTiBT3Gjawn-n057xM-P37_-Ob59a1-1EORsiYIoONLDmDAfBmocNSyEPeCzH2kYm7m9QIawFeWTiyESnmehv8G3O1-GPCwH9XklFGkHSgi_aedAB4oIREKZkVdTOooGcAYTFJTPenGfbr-ht1pT3Aa8EGMqenpN-QUM2wmkjS1KYAhX0SlhYOtyIOSi0Y452yRBKl-KW7DcVV3zKWUYgDDrLcOBJudnqP_ShvIT4s1zXAZxSyfv8KhNHbWFCFeF_eC1u0M-J8nPvYty6uqAjMdFDcJ_GPG4i6CMGXFfztq_GoRn7pseKhro71qLrRd1XyyD7kQ5TS3LqW2qREycUshXN2Mq2o6nSg-Ci4Yda8KZumn4venXHj7zBfqq7u8ORHThdUZu9MS_XvfNzpUNINHSCH5vKoCQTPgrsh3xpJ9Mc2IEbHWL4pEUdTam6KpVsz_Cl1P9s9LfMQ5W8GZYY18CaeyYuTFxmHZck98pdmbjkUe_LbvXuF6nIxKXIDUxciuK_AQAA__-RnCD0">