diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index a0b996beec..e16e7d67c6 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -867,7 +867,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, // Find any previous declaration with this name. DeclContext *SemanticContext; - LookupResult Previous(*this, Name, NameLoc, LookupOrdinaryName, + LookupResult Previous(*this, Name, NameLoc, LookupTagName, ForRedeclaration); if (SS.isNotEmpty() && !SS.isInvalid()) { SemanticContext = computeDeclContext(SS, true); @@ -938,7 +938,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, while (!OutermostContext->isFileContext()) OutermostContext = OutermostContext->getLookupParent(); - if (PrevClassTemplate && + if (PrevDecl && (OutermostContext->Equals(PrevDecl->getDeclContext()) || OutermostContext->Encloses(PrevDecl->getDeclContext()))) { SemanticContext = PrevDecl->getDeclContext(); @@ -951,7 +951,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, } } - if (CurContext->isDependentContext()) { + if (CurContext->isDependentContext() && PrevClassTemplate) { // If this is a dependent context, we don't want to link the friend // class template to the template in scope, because that would perform // checking of the template parameter lists that can't be performed |