[clang-tools-extra] [clang-tidy] Fix false positive for generic lambda parameters in readability-non-const-parameter (PR #179051)
Aditya Singh via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 31 14:03:38 PST 2026
Aditya26189 wrote:
Thanks for the review! Before I revise, I want to make sure I understand the expected behavior.
Looking at the test expectations for `gh176623()`:
- **V1** with `A<tc>(p)`: Template-dependent constructor → no warning expected ✓
- **V2** with `B(p)`: Non-template-dependent constructor → warning expected ✓
However, I'm observing that generic lambda bodies (even with non-template-dependent code) may not be fully traversed by the AST matchers until instantiation. This would prevent analysis of V2's body entirely.
**Question**: Should V2 produce a warning?
- **If yes**: I need to investigate why the lambda body isn't being visited by the matchers. Could you confirm that the checker should analyze non-template-dependent expressions within generic lambdas?
- **If no**: Should I update the test expectations so both V1 and V2 have no warnings (consistent treatment of all generic lambda parameters)?
I want to ensure my fix aligns with the intended behavior before proceeding. Thanks!
https://github.com/llvm/llvm-project/pull/179051
More information about the cfe-commits
mailing list