| Issue |
52890
|
| Summary |
readability-const-return-type does not correctly handle decltype(auto)
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
jgopel
|
As I understand it, `readability-const-return-type` exists to catch cases such as
```cpp
const auto foo() {
return 42;
}
```
It does a good job of catching these sorts of cases, but incorrectly (imo) warns when the `const` is not explicit, such as:
```cpp
decltype(auto) bar() {
static const int i = 42;
return i;
}
```
In cases such as this, removing the `const` is not correct and does not improve readability, as cited by the error message. Here's a live demo of the issue https://godbolt.org/z/7859KTG6x.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs