summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2019-09-07 20:14:09 +0000
committerAaron Ballman <aaron@aaronballman.com>2019-09-07 20:14:09 +0000
commitc4450437ec91334d81a28084c4cf637cfdd8bbcb (patch)
tree9a59e5df0cfd66d9b9304d70e11c5c98fb34c36c /clang/lib
parent8cfff1e1bc2e451af8f099e172dc63b4bcd9be5a (diff)
downloadbcm5719-llvm-c4450437ec91334d81a28084c4cf637cfdd8bbcb.tar.gz
bcm5719-llvm-c4450437ec91334d81a28084c4cf637cfdd8bbcb.zip
Fixes an assertion while instantiating a template with an incomplete typo-corrected type.
Fixes PR35682. When a template in instantiated with an incomplete typo corrected type an assertion can trigger if the -ferror-limit is used to reduce the number of errors. Patch by Mark de Wever. llvm-svn: 371320
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index d7a1d9ea1b9..001e433ad6a 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -735,9 +735,13 @@ Sema::BuildDependentDeclRefExpr(const CXXScopeSpec &SS,
SourceLocation TemplateKWLoc,
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *TemplateArgs) {
+ // DependentScopeDeclRefExpr::Create requires a valid QualifierLoc
+ NestedNameSpecifierLoc QualifierLoc = SS.getWithLocInContext(Context);
+ if (!QualifierLoc)
+ return ExprError();
+
return DependentScopeDeclRefExpr::Create(
- Context, SS.getWithLocInContext(Context), TemplateKWLoc, NameInfo,
- TemplateArgs);
+ Context, QualifierLoc, TemplateKWLoc, NameInfo, TemplateArgs);
}
OpenPOWER on IntegriCloud