Issue 241953
Summary [clang-tidy] `readability-make-member-function-const` should not emit warnings when a `const` overload exists
Labels clang-tidy
Assignees
Reporter Jacobfaib
    ```c++
struct Foo {
  int func() { return x + 1; } // warning: method 'func' can be made const [readability-make-member-function-const]
  int func() const { return x + 2; }

  int x;
};
```
If there already exists an equivalent `const` overload for the method, `readability-make-member-function-const` should not suggest making the existing one `const`.

https://godbolt.org/z/orhx5az6q

Curiously enough, there already seems to be some handling for this. If `func()` returns `void`, `clang-tidy` does not emit any diagnostics.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to