static bool hasVisibleDeclarationImpl(Sema &S, const NamedDecl *D,
llvm::SmallVectorImpl<Module *> *Modules,
Filter F) {
+ bool HasFilteredRedecls = false;
+
for (auto *Redecl : D->redecls()) {
auto *R = cast<NamedDecl>(Redecl);
if (!F(R))
if (S.isVisible(R))
return true;
+ HasFilteredRedecls = true;
+
if (Modules) {
Modules->push_back(R->getOwningModule());
const auto &Merged = S.Context.getModulesWithMergedDefinition(R);
}
}
- return false;
+ // Only return false if there is at least one redecl that is not filtered out.
+ if (HasFilteredRedecls)
+ return false;
+
+ return true;
}
bool Sema::hasVisibleExplicitSpecialization(
// class definition?
return D->getLexicalDeclContext()->isFileContext();
});
-
- return false;
}
/// Determine whether a declaration is visible to name lookup.
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -fmodules %s -verify
+// RUN: %clang_cc1 -fsyntax-only %s -verify
+
+// expected-no-diagnostics
+template <typename Var>
+struct S {
+ template <unsigned N>
+ struct Inner { };
+
+ template <>
+ struct Inner<0> { };
+};
+
+S<int>::Inner<1> I1;
+S<int>::Inner<0> I0;