[modules] Handle defining a class template on top of an existing imported-but-not-visible definition.
llvm-svn: 233341
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index ffd2239..e9c40aa 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -11297,7 +11297,8 @@
ModulePrivateLoc,
/*FriendLoc*/SourceLocation(),
TemplateParameterLists.size()-1,
- TemplateParameterLists.data());
+ TemplateParameterLists.data(),
+ SkipBody);
return Result.get();
} else {
// The "template<>" header is extraneous.
@@ -11696,8 +11697,9 @@
TSK_ExplicitSpecialization;
}
+ NamedDecl *Hidden = nullptr;
if (SkipBody && getLangOpts().CPlusPlus &&
- !hasVisibleDefinition(Def, &Def)) {
+ !hasVisibleDefinition(Def, &Hidden)) {
// There is a definition of this tag, but it is not visible. We
// explicitly make use of C++'s one definition rule here, and
// assume that this definition is identical to the hidden one
@@ -11705,8 +11707,8 @@
// use it in place of this one.
*SkipBody = true;
if (auto *Listener = getASTMutationListener())
- Listener->RedefinedHiddenDefinition(Def, KWLoc);
- Def->setHidden(false);
+ Listener->RedefinedHiddenDefinition(Hidden, KWLoc);
+ Hidden->setHidden(false);
return Def;
} else if (!IsExplicitSpecializationAfterInstantiation) {
// A redeclaration in function prototype scope in C isn't