summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 851f7b96045..6fe8c75441f 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -3454,13 +3454,19 @@ static bool CheckTemplateSpecializationScope(Sema &S,
// the specialized template.
if (!DC->InEnclosingNamespaceSetOf(SpecializedContext) &&
!(S.getLangOptions().CPlusPlus0x && DC->Encloses(SpecializedContext))) {
+ bool IsCPlusPlus0xExtension
+ = !S.getLangOptions().CPlusPlus0x && DC->Encloses(SpecializedContext);
if (isa<TranslationUnitDecl>(SpecializedContext))
- S.Diag(Loc, diag::err_template_spec_decl_out_of_scope_global)
- << EntityKind << Specialized;
+ S.Diag(Loc, IsCPlusPlus0xExtension
+ ? diag::ext_template_spec_decl_out_of_scope_global
+ : diag::err_template_spec_decl_out_of_scope_global)
+ << EntityKind << Specialized;
else if (isa<NamespaceDecl>(SpecializedContext))
- S.Diag(Loc, diag::err_template_spec_decl_out_of_scope)
- << EntityKind << Specialized
- << cast<NamedDecl>(SpecializedContext);
+ S.Diag(Loc, IsCPlusPlus0xExtension
+ ? diag::ext_template_spec_decl_out_of_scope
+ : diag::err_template_spec_decl_out_of_scope)
+ << EntityKind << Specialized
+ << cast<NamedDecl>(SpecializedContext);
S.Diag(Specialized->getLocation(), diag::note_specialized_entity);
ComplainedAboutScope = true;
OpenPOWER on IntegriCloud