summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 75d7f70a636..f7d9787fbea 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3555,9 +3555,11 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
assert(PatternDecl && "instantiating a non-template");
const FunctionDecl *PatternDef = PatternDecl->getDefinition();
- Stmt *Pattern = PatternDef->getBody(PatternDef);
- if (PatternDef)
+ Stmt *Pattern = nullptr;
+ if (PatternDef) {
+ Pattern = PatternDef->getBody(PatternDef);
PatternDecl = PatternDef;
+ }
// FIXME: We need to track the instantiation stack in order to know which
// definitions should be visible within this instantiation.
OpenPOWER on IntegriCloud