Fznamznon marked 2 inline comments as done. Fznamznon added inline comments.
================ Comment at: clang/lib/Sema/SemaLambda.cpp:1381 + if (Capture.Id == TP->getIdentifier()) { + Diag(Capture.Loc, diag::err_template_param_shadow) << Capture.Id; + Diag(TP->getLocation(), diag::note_template_param_here); ---------------- shafik wrote: > It is really a shame that this is just different enough that we can't turn > `CheckRedefinition` into a generic lambda and reuse it here. The code > duplication is very unfortunate. What I could do here is modify `err_parameter_shadow_capture` message so it says either `a lambda parameter cannot shadow an explicitly captured entity` or `a lambda template parameter cannot shadow an explicitly captured entity` and make `CheckRedefinition` accept a `NamedDecl` and a flag whether we're diagnosing a template parameter. Then `CheckRedefinition` can be reused, resolving the concerns about code duplication and the fact that explicit capture comes before the template parameter. That would probably be inconsistent with how the templates are diagnosed now though. WDYT? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148712/new/ https://reviews.llvm.org/D148712 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits