diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-12 05:24:55 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-12 05:24:55 +0000 |
commit | a4d5de539bc2f0cd25d6292e84eaa067591ff792 (patch) | |
tree | 7f6991aca9d4142dab306b98a0331c7fbbd7f656 /lib/Sema/SemaTemplate.cpp | |
parent | 121dc9ab38bda202720c506c26c67457eb967f02 (diff) |
When diagnosing C++ [temp.expl.spec]p3 in C++98/03 mode, downgrade the
error to a warning if we're in a case that would be allowed in
C++0x. This "fixes" PR8084 by making Clang accept more code than GCC
and (non-strict) EDG do.
Also, add the missing test case for the C++0x semantics, which should
have been in r113717.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113718 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 851f7b9604..6fe8c75441 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/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; |