[clang] [Clang] add emit -Wignored-cv-qualifiers diagnostic for cv-qualified base classes (PR #132116)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 20 06:01:05 PDT 2025
https://github.com/erichkeane commented:
This I think ends up being the 'minimum' patch here, but see my suggestion on the bug:
>I also believe there is value to only diagnosing this on EXPLICIT qualifiers (or a separate, additional warning to do so), not ones that get picked up from the template.
The more I think about it, the more I think that we should modify the warning to only happen on EXPLICIT qualifiers. So:
```
struct Base{};
using CBase = const Base;
struct D1 : const Base {}; // DOES warn
struct D2 : CBase{}; // a DIFFERENT warning (same wording perhaps?) under a different group.
template<typename T> Templ: const T{};
Templ<Base> t; // Causes same warning as D1.
template<typename T> Templ2 : T{};
Templ2<CBase> t; // Causes same warning as D2.
```
If you search for where that diagnostic is emitted, you should see that. You might have to do some debugging to figure out how to differentiate the cases though.
https://github.com/llvm/llvm-project/pull/132116
More information about the cfe-commits
mailing list