summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-11-18 19:49:19 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-11-18 19:49:19 +0000
commit678f50b622fec656bc57f0deb77166f2b11b918a (patch)
tree22205bbaec981d63a99adb99528535d419c05972 /clang/lib/Sema/SemaTemplate.cpp
parent87f03971fdf9a1968a11e4ef989e9a827ae7528e (diff)
downloadbcm5719-llvm-678f50b622fec656bc57f0deb77166f2b11b918a.tar.gz
bcm5719-llvm-678f50b622fec656bc57f0deb77166f2b11b918a.zip
[Sema] Don't work around a malformed AST
We created a malformed TemplateSpecializationType: it was dependent but had a RecordType as it's canonical type. This would lead getAs to crash. r249090 worked around this but we should fix this for real by providing a more appropriate template specialization type as the canonical type. This fixes PR24246. llvm-svn: 253495
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 8821088baac..c4c28148834 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -6408,7 +6408,17 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
if (!PrevDecl)
ClassTemplate->AddSpecialization(Specialization, InsertPos);
- CanonType = Context.getTypeDeclType(Specialization);
+ if (CurContext->isDependentContext()) {
+ // -fms-extensions permits specialization of nested classes without
+ // fully specializing the outer class(es).
+ assert(getLangOpts().MicrosoftExt &&
+ "Only possible with -fms-extensions!");
+ TemplateName CanonTemplate = Context.getCanonicalTemplateName(Name);
+ CanonType = Context.getTemplateSpecializationType(
+ CanonTemplate, Converted.data(), Converted.size());
+ } else {
+ CanonType = Context.getTypeDeclType(Specialization);
+ }
}
// C++ [temp.expl.spec]p6:
OpenPOWER on IntegriCloud