[clang-tools-extra] [clang-tidy] make `misc-const-correctness` work with `auto` variables and lambdas (PR #157319)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 4 14:01:51 PST 2025
vbvictor wrote:
> As of c++20, you can reassign a lambda variable, if it meets certain conditions.
Thank you for the insights on C++20, didn't know that!
I'm happy if we make all options "on-by-default" so that users would know about new places to add `const`, but just make a fallback to disable lambdas if not willing to pursue "const lambdas".
P.S. looking at some internal codebases, even with disabled `const-correctness` check we tend to make regular variables `const` and lambdas `non-const` so I would personally probably use "IgnoreLambdas" option if we ever enable `const-correctness`.
https://github.com/llvm/llvm-project/pull/157319
More information about the cfe-commits
mailing list