[llvm-branch-commits] [cfe-branch] r119246 - in /cfe/branches/Apple/whitney: lib/Sema/SemaOverload.cpp test/SemaCXX/friend.cpp

Daniel Dunbar daniel at zuster.org
Mon Nov 15 13:45:50 PST 2010


Author: ddunbar
Date: Mon Nov 15 15:45:50 2010
New Revision: 119246

URL: http://llvm.org/viewvc/llvm-project?rev=119246&view=rev
Log:
Merge r118670:
--
Author: John McCall <rjmccall at apple.com>
Date:   Wed Nov 10 03:01:53 2010 +0000

    Friend function declarations can overload with tag declarations.
    Fixes PR7915.

Modified:
    cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp
    cfe/branches/Apple/whitney/test/SemaCXX/friend.cpp

Modified: cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp?rev=119246&r1=119245&r2=119246&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp Mon Nov 15 15:45:50 2010
@@ -583,10 +583,12 @@
         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

Modified: cfe/branches/Apple/whitney/test/SemaCXX/friend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaCXX/friend.cpp?rev=119246&r1=119245&r2=119246&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaCXX/friend.cpp (original)
+++ cfe/branches/Apple/whitney/test/SemaCXX/friend.cpp Mon Nov 15 15:45:50 2010
@@ -71,3 +71,11 @@
   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(); };
+}





More information about the llvm-branch-commits mailing list