diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-10-07 17:30:37 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-10-07 17:30:37 +0000 |
commit | 40fb74484ee6502b1008d0af10034c1cc46a9186 (patch) | |
tree | 07a7428cbab2557f5a3dc74ac93ac634d8cd56e2 /clang/lib/Sema/SemaTemplate.cpp | |
parent | ae01f78a31f2eafade93e2247e31b6c1e6c80c02 (diff) | |
download | bcm5719-llvm-40fb74484ee6502b1008d0af10034c1cc46a9186.tar.gz bcm5719-llvm-40fb74484ee6502b1008d0af10034c1cc46a9186.zip |
Diagnose explicit instantiations and specializations that occur in class scope
llvm-svn: 83473
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 9d7dd0a0569..6792b28d1c8 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2433,11 +2433,13 @@ static bool CheckTemplateSpecializationScope(Sema &S, << TSK << Specialized; return true; } - - // FIXME: For everything except class template partial specializations, - // complain if the explicit specialization/instantiation occurs at class - // scope. + if (S.CurContext->isRecord() && !IsPartialSpecialization) { + S.Diag(Loc, diag::err_template_spec_decl_class_scope) + << TSK << Specialized; + return true; + } + // C++ [temp.class.spec]p6: // A class template partial specialization may be declared or redeclared // in any namespace scope in which its definition may be defined (14.5.1 |