================ @@ -8236,11 +8236,14 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, DeclContext *NewDC = D->getDeclContext(); if (FieldDecl *FD = dyn_cast<FieldDecl>(ShadowedDecl)) { - // Fields are not shadowed by variables in C++ static methods. - if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(NewDC)) + if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(NewDC)) { + // Fields are not shadowed by variables in C++ static methods. if (MD->isStatic()) return; + if (!MD->getParent()->isLambda() && MD->isExplicitObjectMemberFunction()) + return; ---------------- Sirraide wrote:
> Thanks for bringing that to my attention. In such cases > > ```c++ > struct C { > int b = 5; > int foo() { > return [a = b]() { > return [=, b = a]() { > return b; > }(); > }(); > } > }; > ``` > > depending exclusively on `isExplicitObjectMemberFunction` isn’t safe, as it > could lead to assertion failures during type resolution Er, can you elaborate what the problem here is maybe? https://github.com/llvm/llvm-project/pull/114813 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits