From e8292b10a61adc03a8c0a3be47d3e39e0aa29b64 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 10 Feb 2015 03:28:10 +0000 Subject: [modules] When determining whether a name from a module replaces a name we already have, check whether the name from the module is actually newer than the existing declaration. If it isn't, we might (say) replace a visible declaration with an injected friend, and thus make it invisible (or lose a default argument or an array bound). llvm-svn: 228661 --- clang/lib/Sema/SemaLookup.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/Sema/SemaLookup.cpp') diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 8edbc1871b4..9184a9fd828 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -414,6 +414,8 @@ void LookupResult::resolveKind() { if (!Unique.insert(D).second) { // If it's not unique, pull something off the back (and // continue at this index). + // FIXME: This is wrong. We need to take the more recent declaration in + // order to get the right type, default arguments, etc. Decls[I] = Decls[--N]; continue; } @@ -1254,6 +1256,9 @@ static NamedDecl *findAcceptableDecl(Sema &SemaRef, NamedDecl *D) { for (auto RD : D->redecls()) { if (auto ND = dyn_cast(RD)) { + // FIXME: This is wrong in the case where the previous declaration is not + // visible in the same scope as D. This needs to be done much more + // carefully. if (LookupResult::isVisible(SemaRef, ND)) return ND; } -- cgit v1.2.3