================
@@ -12832,6 +12833,15 @@ bool Sema::CheckUsingShadowDecl(BaseUsingDecl *BUD, 
NamedDecl *Orig,
       (isa_and_nonnull<UnresolvedUsingIfExistsDecl>(NonTag))) {
     if (!NonTag && !Tag)
       return false;
+
+    // Only report the error if this using_if_exists decl can be a
+    // substitute for the original decl. LookupResult will find things with
+    // the same name but we also want to take into account namespaces and
+    // other scopes. GlobalDecl helps take care of that.
+    NamedDecl *UsedTag = NonTag ? NonTag : Tag;
+    if (GlobalDecl(Target) != GlobalDecl(UsedTag))
----------------
PiJoules wrote:

TBH I forgot why I used `GlobalDecl` but you're right in pointing out that it 
just does a pointer comparison in the end, so removed it.

https://github.com/llvm/llvm-project/pull/167646
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to