summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateDeduction.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-08-23 06:16:52 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-08-23 06:16:52 +0000
commit802c4b7015d4b7236b822d3ebda8b428a1be20ad (patch)
tree18fef6975b5f037982060652ca12d8b75d463d8c /clang/lib/Sema/SemaTemplateDeduction.cpp
parent7bdc8ae20b5baaf33429f48b651ea97d569c70cd (diff)
downloadbcm5719-llvm-802c4b7015d4b7236b822d3ebda8b428a1be20ad.tar.gz
bcm5719-llvm-802c4b7015d4b7236b822d3ebda8b428a1be20ad.zip
Fix undefined behavior: member function calls where 'this' is a null pointer.
llvm-svn: 162430
Diffstat (limited to 'clang/lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateDeduction.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 9500ec3219d..48ad0bf8317 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -570,6 +570,9 @@ static void PrepareArgumentPackDeduction(Sema &S,
SavedPacks[I] = Deduced[PackIndices[I]];
Deduced[PackIndices[I]] = TemplateArgument();
+ if (!S.CurrentInstantiationScope)
+ continue;
+
// If the template arugment pack was explicitly specified, add that to
// the set of deduced arguments.
const TemplateArgument *ExplicitArgs;
@@ -2601,7 +2604,8 @@ Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate,
// explicitly-specified set (C++0x [temp.arg.explicit]p9).
const TemplateArgument *ExplicitArgs;
unsigned NumExplicitArgs;
- if (CurrentInstantiationScope->getPartiallySubstitutedPack(&ExplicitArgs,
+ if (CurrentInstantiationScope &&
+ CurrentInstantiationScope->getPartiallySubstitutedPack(&ExplicitArgs,
&NumExplicitArgs)
== Param)
Builder.push_back(TemplateArgument(ExplicitArgs, NumExplicitArgs));
OpenPOWER on IntegriCloud