]> granicus.if.org Git - clang/commitdiff
Friend function declarations can overload with tag declarations.
authorJohn McCall <rjmccall@apple.com>
Wed, 10 Nov 2010 03:01:53 +0000 (03:01 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 10 Nov 2010 03:01:53 +0000 (03:01 +0000)
Fixes PR7915.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118670 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp
test/SemaCXX/friend.cpp

index 440f5acdbc238c7050a56de3557a2dbd5ac4c973..4c843ea738229b2b5537686d5474efae59fb85b3 100644 (file)
@@ -584,10 +584,12 @@ Sema::CheckOverload(Scope *S, FunctionDecl *New, const LookupResult &Old,
         Match = *I;
         return Ovl_Match;
       }
-    } else if (isa<UsingDecl>(OldD) || isa<TagDecl>(OldD)) {
+    } else if (isa<UsingDecl>(OldD)) {
       // We can overload with these, which can show up when doing
       // redeclaration checks for UsingDecls.
       assert(Old.getLookupKind() == LookupUsingDeclName);
+    } else if (isa<TagDecl>(OldD)) {
+      // We can always overload with tags by hiding them.
     } else if (isa<UnresolvedUsingValueDecl>(OldD)) {
       // Optimistically assume that an unresolved using decl will
       // overload; if it doesn't, we'll have to diagnose during
index e35c500e9a70844360f076fa7e3f009eab1228c0..939d3ae456879f3a62ee3ba09193b7015779f463 100644 (file)
@@ -71,3 +71,11 @@ struct B : A
   template<int> friend A::~A(); // expected-error {{does not match}}
 };
 }
+
+// PR7915
+namespace test5 {
+  struct A;
+  struct A1 { friend void A(); };
+
+  struct B { friend void B(); };
+}