summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/TemplateName.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/TemplateName.cpp')
-rw-r--r--clang/lib/AST/TemplateName.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/AST/TemplateName.cpp b/clang/lib/AST/TemplateName.cpp
index ef7b315314d..439f4e81ade 100644
--- a/clang/lib/AST/TemplateName.cpp
+++ b/clang/lib/AST/TemplateName.cpp
@@ -44,8 +44,14 @@ TemplateDecl *TemplateName::getAsTemplateDecl() const {
bool TemplateName::isDependent() const {
if (TemplateDecl *Template = getAsTemplateDecl()) {
- return isa<TemplateTemplateParmDecl>(Template) ||
- Template->getDeclContext()->isDependentContext();
+ if (isa<TemplateTemplateParmDecl>(Template))
+ return true;
+ // FIXME: Hack, getDeclContext() can be null if Template is still
+ // initializing due to PCH reading, so we check it before using it.
+ // Should probably modify TemplateSpecializationType to allow constructing
+ // it without the isDependent() checking.
+ return Template->getDeclContext() &&
+ Template->getDeclContext()->isDependentContext();
}
assert(!getAsOverloadedTemplate() &&
OpenPOWER on IntegriCloud