diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-22 22:03:31 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-22 22:03:31 +0000 |
commit | 392497bebe6b17b225256ae204b20b71ca48867b (patch) | |
tree | af9a540a1de9794765b0cef7b98c424332cd642f /clang/lib/Sema/SemaTemplate.cpp | |
parent | 829c6e6f41e89eead9311407f504b7113ee22926 (diff) | |
download | bcm5719-llvm-392497bebe6b17b225256ae204b20b71ca48867b.tar.gz bcm5719-llvm-392497bebe6b17b225256ae204b20b71ca48867b.zip |
Fix assert if an attempt is made to explicitly instantiate an alias template.
Patch by Ismail Pazarbasi!
llvm-svn: 184650
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 7ad31316270..88b24a1702c 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -6341,14 +6341,22 @@ Sema::ActOnExplicitInstantiation(Scope *S, AttributeList *Attr) { // Find the class template we're specializing TemplateName Name = TemplateD.getAsVal<TemplateName>(); - ClassTemplateDecl *ClassTemplate - = cast<ClassTemplateDecl>(Name.getAsTemplateDecl()); - + TemplateDecl *TD = Name.getAsTemplateDecl(); // Check that the specialization uses the same tag kind as the // original template. TagTypeKind Kind = TypeWithKeyword::getTagTypeKindForTypeSpec(TagSpec); assert(Kind != TTK_Enum && "Invalid enum tag in class template explicit instantiation!"); + + if (isa<TypeAliasTemplateDecl>(TD)) { + Diag(KWLoc, diag::err_tag_reference_non_tag) << Kind; + Diag(TD->getTemplatedDecl()->getLocation(), + diag::note_previous_use); + return true; + } + + ClassTemplateDecl *ClassTemplate = cast<ClassTemplateDecl>(TD); + if (!isAcceptableTagRedeclaration(ClassTemplate->getTemplatedDecl(), Kind, /*isDefinition*/false, KWLoc, *ClassTemplate->getIdentifier())) { |