[cfe-commits] r118670 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/friend.cpp
John McCall
rjmccall at apple.com
Tue Nov 9 19:01:53 PST 2010
Author: rjmccall
Date: Tue Nov 9 21:01:53 2010
New Revision: 118670
URL: http://llvm.org/viewvc/llvm-project?rev=118670&view=rev
Log:
Friend function declarations can overload with tag declarations.
Fixes PR7915.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaCXX/friend.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=118670&r1=118669&r2=118670&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue Nov 9 21:01:53 2010
@@ -584,10 +584,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/trunk/test/SemaCXX/friend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/friend.cpp?rev=118670&r1=118669&r2=118670&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/friend.cpp (original)
+++ cfe/trunk/test/SemaCXX/friend.cpp Tue Nov 9 21:01:53 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 cfe-commits
mailing list