From: Richard Smith Date: Fri, 20 Apr 2012 05:42:36 +0000 (+0000) Subject: Fix a bug which creduce found reducing PR12585. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2f245e77de13c6619923d6569a947e6dcdd0666;p=clang Fix a bug which creduce found reducing PR12585. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155185 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index ff8c4dacc2..a0b996beec 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -938,7 +938,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, while (!OutermostContext->isFileContext()) OutermostContext = OutermostContext->getLookupParent(); - if (PrevDecl && + if (PrevClassTemplate && (OutermostContext->Equals(PrevDecl->getDeclContext()) || OutermostContext->Encloses(PrevDecl->getDeclContext()))) { SemanticContext = PrevDecl->getDeclContext(); diff --git a/test/SemaTemplate/class-template-decl.cpp b/test/SemaTemplate/class-template-decl.cpp index ec4e016385..4d69ac4f71 100644 --- a/test/SemaTemplate/class-template-decl.cpp +++ b/test/SemaTemplate/class-template-decl.cpp @@ -95,3 +95,12 @@ namespace rdar9676205 { }; } +namespace Redecl { + struct S { + int packaged_task; + template class future { + template friend class packaged_task; + }; + future share; + }; +}