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 | 0a4074768a6ecd81513f0db02bfb0e96ab3e56a0 (patch) | |
tree | a5f624416a553d43f5d0d42f8cc3a533d2b2cad2 /lib/Sema/SemaTemplate.cpp | |
parent | ca4fb04b5c43f866c095a3bcc14e02a150da2568 (diff) |
Diagnose explicit instantiations and specializations that occur in class scope
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 9d7dd0a056..6792b28d1c 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/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 |