Issue |
131935
|
Summary |
[Clang][Diagnostics] Consider splitting warning on cv-qualified base classes into a separate group
|
Labels |
clang
|
Assignees |
|
Reporter |
MagentaTreehouse
|
In PR #121419, warnings were added for cv-qualified base classes. I consider it too noisy in some scenarios. Consider this code:
```c++
#include <type_traits>
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:
```console
<source>:4:11: warning: 'const' qualifier on base class type 'decltype(op0)' (aka 'const (lambda at <source>:3:27)') has no effect [-Wignored-qualifiers]
4 | struct A: decltype(op0) { /* members */ };
| ^
<source>:4:11: note: base class 'decltype(op0)' (aka 'const (lambda at <source>:3:27)') specified here
<source>:6:11: warning: 'const' qualifier on base class type 'decltype(op1)' (aka 'const (lambda at <source>:5:27)') has no effect [-Wignored-qualifiers]
6 | struct B: decltype(op1) { /* members */ };
| ^
<source>:6:11: note: base class 'decltype(op1)' (aka 'const (lambda at <source>: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
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs