From: John McCall Date: Wed, 10 Nov 2010 03:01:53 +0000 (+0000) Subject: Friend function declarations can overload with tag declarations. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d7945c6bfd9e0cc7ed451e6c4acd8860f2d0eaba;p=clang Friend function declarations can overload with tag declarations. Fixes PR7915. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118670 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 440f5acdbc..4c843ea738 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -584,10 +584,12 @@ Sema::CheckOverload(Scope *S, FunctionDecl *New, const LookupResult &Old, Match = *I; return Ovl_Match; } - } else if (isa(OldD) || isa(OldD)) { + } else if (isa(OldD)) { // We can overload with these, which can show up when doing // redeclaration checks for UsingDecls. assert(Old.getLookupKind() == LookupUsingDeclName); + } else if (isa(OldD)) { + // We can always overload with tags by hiding them. } else if (isa(OldD)) { // Optimistically assume that an unresolved using decl will // overload; if it doesn't, we'll have to diagnose during diff --git a/test/SemaCXX/friend.cpp b/test/SemaCXX/friend.cpp index e35c500e9a..939d3ae456 100644 --- a/test/SemaCXX/friend.cpp +++ b/test/SemaCXX/friend.cpp @@ -71,3 +71,11 @@ struct B : A template friend A::~A(); // expected-error {{does not match}} }; } + +// PR7915 +namespace test5 { + struct A; + struct A1 { friend void A(); }; + + struct B { friend void B(); }; +}