aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-08 15:14:33 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-08 15:14:33 +0000
commitf6b1185f0a8a209c06dfc1efdb6a59cc851e970c (patch)
tree32a1f28a10bdce3da2bd6477c6ed113a46c6a3a4 /lib/Sema/SemaDecl.cpp
parent251b4ff2578e26959a4c036140ccd61c5e9292f2 (diff)
Improve checking for specializations of member classes of class
templates, and keep track of how those member classes were instantiated or specialized. Make sure that we don't try to instantiate an explicitly-specialized member class of a class template, when that explicit specialization was a declaration rather than a definition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83547 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 2070335a61..267eea8a1b 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -4161,11 +4161,14 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
TemplateParameterLists.release();
return Result.get();
} else {
- // FIXME: diagnose the extraneous 'template<>', once we recover
- // slightly better in ParseTemplate.cpp from bogus template
- // parameters.
+ // The "template<>" header is extraneous.
+ Diag(TemplateParams->getTemplateLoc(), diag::err_template_tag_noparams)
+ << ElaboratedType::getNameForTagKind(Kind) << Name;
+ isExplicitSpecialization = true;
}
}
+
+ TemplateParameterLists.release();
}
DeclContext *SearchDC = CurContext;
@@ -4493,6 +4496,11 @@ CreateNewDecl:
}
}
+ // If this is a specialization of a member class (of a class template),
+ // check the specialization.
+ if (isExplicitSpecialization && CheckMemberSpecialization(New, PrevDecl))
+ Invalid = true;
+
if (Invalid)
New->setInvalidDecl();