summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-12 05:24:55 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-12 05:24:55 +0000
commit8ce63154d07fb4924d5fcbbc0dd96f7f19634831 (patch)
tree643b75c3abdd4c7049b7dd15b3b4f4bac164ae78 /clang/lib/Sema
parentb1aab4388791192029e59462819eebb820ee3631 (diff)
downloadbcm5719-llvm-8ce63154d07fb4924d5fcbbc0dd96f7f19634831.tar.gz
bcm5719-llvm-8ce63154d07fb4924d5fcbbc0dd96f7f19634831.zip
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. llvm-svn: 113718
Diffstat (limited to 'clang/lib/Sema')
-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