Open Quuxplusone opened 9 years ago
Implemented in r279507.
Sorry, closed by mistake. r279507 check constness of parameters.
Would need to be transitive though to be useful.
If you have a pointer as member and call non-const methods on it the parent
method shouldn't be const.
There is utility functionality in clang-tidy that can in principle determine if a method is used as const and that usecase was specificially mentioned.
See https://reviews.llvm.org/D45444 for a first version using this utility function, in principle it could be used to analyze the this-pointer in methods.
Hi!
I think will be great to have warning which will suggest to make non-vuirtual method const if doesn't modify object's state and/or call only other const methods.
Eugene.