diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-07-31 01:43:05 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-07-31 01:43:05 +0000 |
commit | 1503f777d94fc05a89c7305651d4b0221c63f586 (patch) | |
tree | 7a88982403616523cecfe937e939dbad7471dfe3 /lib/Sema/SemaTemplate.cpp | |
parent | 3503d041ca8a3535a1c1a30005a6b18ae7aed5db (diff) |
Make the check for the linkage of a template handle the case of nested
linkage specifications correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77653 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 4264f32e9d..29258575c1 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -2123,13 +2123,12 @@ Sema::CheckTemplateDeclScope(Scope *S, // A template-declaration can appear only as a namespace scope or // class scope declaration. DeclContext *Ctx = static_cast<DeclContext *>(S->getEntity()); - while (Ctx && isa<LinkageSpecDecl>(Ctx)) { - if (cast<LinkageSpecDecl>(Ctx)->getLanguage() != LinkageSpecDecl::lang_cxx) - return Diag(TemplateLoc, diag::err_template_linkage) - << TemplateRange; - + if (Ctx && isa<LinkageSpecDecl>(Ctx) && + cast<LinkageSpecDecl>(Ctx)->getLanguage() != LinkageSpecDecl::lang_cxx) + return Diag(TemplateLoc, diag::err_template_linkage) << TemplateRange; + + while (Ctx && isa<LinkageSpecDecl>(Ctx)) Ctx = Ctx->getParent(); - } if (Ctx && (Ctx->isFileContext() || Ctx->isRecord())) return false; |