<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56776>56776</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`misc-const-correctness` not reported
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
firewave
</td>
</tr>
</table>
<pre>
```cpp
#include <list>
class A
{
public:
A();
virtual ~A();
};
class B : public A
{
public:
B();
};
void f1(std::list<A*> l)
{
for(A* a: l)
{
B* b = dynamic_cast<B*>(a); // no warning
(void)b;
}
}
void f2(std::list<A*> l)
{
for(A* a: l) // no warning
{
const B* b = dynamic_cast<const B*>(a);
(void)b;
}
}
void f3(std::list<A*> l)
{
for(A* a: l)
{
B* b = (B*)a; // no warning
(void)b;
}
}
void f4(std::list<A*> l)
{
for(A* a: l) // no warning
{
const B* b = (const B*)a;
(void)b;
}
}
```
https://godbolt.org/z/a3M4j9b96
Please disregard the bogus casting in `f3()` and `f4()`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVNuO2yAQ_Rr8gjZywDce_JBs0rdK_YMKA3ZYEWMBTrT9-g44u0l2pW1VbataNmaY4cw5M4jOyucWVfnyimlC-Q7lG0SoHoWZpcKIPhrtA6L7iyuNwnDv8cVA9XaZTHNntED0so7hAagGEYbo9rp20i7M3GBU79-6Ub27zm8ybYHHBi_4v5N2-0vck9US92uI80HGvXSz6HwETmDtsYkA95kidG8dbIpBmEdS17DovQu9MNngDujvsHwe-VGL74KnPNslD4DxhSpG5Au8eLT4zN2ox-EeCiIjawju7uoZxb2qfCeRfI7Ej8i9Ey3s6MMH0q_-uwJ8hlz6LzsK25IIwvhf61_xP_QP4G56tsj9Y3Ev181iHkKYfFSX-A1WdtaElXUDWD_g4_Rr8cQ6Vt2W5ptR3CsstXdq4E7icFC4s8PscTxioA7rEUOOdB5ilaoc81GmpeJ1aZWpdl2VLM8bWrNMtlQyyngWdDAq3otH7cVDUg6jc0qEUXkfwUYbsFOTdUHJbHamfaNDh8PcrYQ9gmHM6eX3MDn7BDBgau9n5WFSVnVdZYeW0oaXpCm6XLJCsLwoawaXMhElk7xifWZ4p4xvUQldIKM64wQBc1TuMt2SnJC8Js16TRltViVfl70QZS_XpGl4gYpcHbk2q8gjFjhzbaLUzYMHZzxb_uqEa1cPo1IpHeDzORysa3vt1JmfVJZyt4n7Tztznu0">