[clang-tidy] detect `const`-qualified member functions which are not physically const
Open
check-request
clang-tidy
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```cpp
struct SS
{
void fn();
};
struct S
{
void fn() const
{
m_ss->fn(); // allowed but breaks constness
}
private:
SS* m_ss;
};
```
The code above is valid but the constness of the called function is misleading.
This could be mitigated using [std::experimental::propagate_const](https://en.cppreference.com/cpp/experimental/propagate_const) for `S::m_ss`.
Contributor guide
Assessment
This issue has not been assessed yet.