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 | 8ce63154d07fb4924d5fcbbc0dd96f7f19634831 (patch) | |
| tree | 643b75c3abdd4c7049b7dd15b3b4f4bac164ae78 /clang/lib/Sema/SemaTemplate.cpp | |
| parent | b1aab4388791192029e59462819eebb820ee3631 (diff) | |
| download | bcm5719-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/SemaTemplate.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 16 |
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; |

