<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/139677>139677</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Confusing error message for const cast between types with the same name
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
clang:frontend,
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hnrklssn
</td>
</tr>
</table>
<pre>
```
namespace foo {
class Type {};
}
const foo::Type *bar();
class Type {};
const_cast<Type*>(bar()); // error: const_cast from 'const Type *' to 'Type *' is not allowed
```
When types have the same name we should emit diagnostics that refer to the fully qualified type names, to disambiguate. I'm sure other diagnostics suffer from the same problem, perhaps the DiagnosticsEngine or something could handle this automatically?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0U0GPmzwQ_TXDZbQRGIiTAwc22Ujf_ZN6rAwM2K2xqcdslH9fmaSbXVWVkADPvDfPT28Us5kcUQP1K9TnTK1R-9BoF35aZpd1frg1sM8fT946NRMvqiccvUeQr5C3iL1VzPj_baHtSJ6hTIX0kbe9dxxTO5QtlO29S7SdCiAOII733n9RPPDfe8URylNqANFC-Qbi8KTYWBDEBcQFKQQfoGzxicQx-BlByLuYPxpASIw-nX8-MYzOR1TW-isNScQnAyBvv2lyGG8LMWr1Thg1IauZMJmDV0LWfrUD0mwiDkZNznM0PWPUKmKgkUKammDjau0Nf63KmtHQsLFuNAzilJoGw2ruzLSqSDv8D4SckddA6KOm8IWd1zExbzf9kLQE31maE9tCQauFt9r5iXtzk3GEPiD7maI2bsJ-06-VG2y6nmFUa_SziqZX1t6gvGRDUw7H8qgyagpZyaI4VAeR6WYY9rLO67ITo8wPYy9rNQyVksVeVFKWIjONyEWd10WZ76tCiF1RyX3eFYMouqro9wRVTrMydmft-7zzYcoM80pNUR73UmZWdWR5C6wQvVVuAiFAnD7-ynYM3kVyw1-FT3alWn3OQpOmvHTrxFDl1nDk59xoot1W47Th6zOevBtXThZtIcOZmNWUliHc04Zb2jqKV_oIydVE_TUk2Rpso2NcOO3EltrJRL12u97PIC5JweP1sgT_g_oI4rLZwCAuDyfeG_E7AAD__6hVNPs">