================
@@ -8627,12 +8627,12 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl
*ShadowedDecl,
DeclContext *NewDC = D->getDeclContext();
if (FieldDecl *FD = dyn_cast<FieldDecl>(ShadowedDecl)) {
- if (const auto *MD =
- dyn_cast<CXXMethodDecl>(getFunctionLevelDeclContext())) {
- // Fields aren't shadowed in C++ static members or in member functions
- // with an explicit object parameter.
+ DeclContext *FnDC = getFunctionLevelDeclContext();
+ if (const auto *MD = dyn_cast<CXXMethodDecl>(FnDC)) {
if (MD->isStatic() || MD->isExplicitObjectMemberFunction())
return;
+ } else if (isa<FunctionDecl>(FnDC)) {
+ return;
----------------
brunodf-gf wrote:
There should be a comment to explain which case you intend to catch here. Even
better would be if you can test explicitly for an inline-defined friend
function here (but I don't know how to do that myself).
https://github.com/llvm/llvm-project/pull/221249
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits