diff options
author | John McCall <rjmccall@apple.com> | 2010-05-28 01:41:47 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-05-28 01:41:47 +0000 |
commit | 9da9cdfd5ac5fcbb8c6a9fc38938e845e53af1ed (patch) | |
tree | 4f8cf7b44281ff6be347f72d809bc6e814c413e3 /lib/Sema/SemaDeclCXX.cpp | |
parent | 707bef3207a1459dc49ebc3c2493ec9a35e06ab8 (diff) |
When filtering out previous declarations of friend functions, consider the
lookup context, not the direct semantic context. Fixes PR7230.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104917 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 9697f1357f..8630e73cee 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -5762,13 +5762,18 @@ Sema::ActOnFriendFunctionDecl(Scope *S, LookupQualifiedName(Previous, DC); - // If searching in that context implicitly found a declaration in - // a different context, treat it like it wasn't found at all. + // Ignore things found implicitly in the wrong scope. // TODO: better diagnostics for this case. Suggesting the right // qualified scope would be nice... - // FIXME: getRepresentativeDecl() is not right here at all - if (Previous.empty() || - !Previous.getRepresentativeDecl()->getDeclContext()->Equals(DC)) { + LookupResult::Filter F = Previous.makeFilter(); + while (F.hasNext()) { + NamedDecl *D = F.next(); + if (!D->getDeclContext()->getLookupContext()->Equals(DC)) + F.erase(); + } + F.done(); + + if (Previous.empty()) { D.setInvalidType(); Diag(Loc, diag::err_qualified_friend_not_found) << Name << T; return DeclPtrTy(); |