[Clang][Diagnostics] Consider splitting warning on cv-qualified base classes into a separate group (original) (raw)

In PR #121419, warnings were added for cv-qualified base classes. I consider it too noisy in some scenarios. Consider this code:

#include

inline constexpr auto op0{[] { /* do work / }}; struct A: decltype(op0) { / members / }; inline constexpr auto op1{[] { / do work / }}; struct B: decltype(op1) { / members */ }; // and on and on and on... // and on and on and on...

// fix: =[ struct C: std::remove_cv_t<decltype(op1)> { /* members */ }; // and on and on and on...

Warnings:

:4:11: warning: 'const' qualifier on base class type 'decltype(op0)' (aka 'const (lambda at :3:27)') has no effect [-Wignored-qualifiers] 4 | struct A: decltype(op0) { /* members */ }; | ^ :4:11: note: base class 'decltype(op0)' (aka 'const (lambda at :3:27)') specified here :6:11: warning: 'const' qualifier on base class type 'decltype(op1)' (aka 'const (lambda at :5:27)') has no effect [-Wignored-qualifiers] 6 | struct B: decltype(op1) { /* members */ }; | ^ :6:11: note: base class 'decltype(op1)' (aka 'const (lambda at :5:27)') specified here

and on and on and on...

The const comes from decltyping from constexpr variables. I would argue that the language rule is doing me a favor here, so that I don't have to add unnecessary verbosity by specifying std::remove_cv_t to each one of them.

It would be nice to split this warning into a separate group, so that it is not enabled by -Wextra, or that at least I can turn this specific warning off.

CC @a-tarasyuk @erichkeane