aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateDeduction.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-09 01:26:06 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-09 01:26:06 +0000
commitfe52c91dcd1ecda90b579f789baf70f7a992e3c9 (patch)
tree442c5905301121329d26b4c881ffd58829b5e747 /lib/Sema/SemaTemplateDeduction.cpp
parent22b8827d340d2993639c2ec53e9d2b4e4d876beb (diff)
Be more careful about picking a template parameter when we fail to substitute explicit template arguments into a function template
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103369 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index aca820dec6..b85f2bd422 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -1189,8 +1189,10 @@ Sema::SubstituteExplicitTemplateArguments(
ExplicitTemplateArgs,
true,
Builder) || Trap.hasErrorOccurred()) {
- Info.Param = makeTemplateParameter(TemplateParams->getParam(
- Builder.structuredSize()));
+ unsigned Index = Builder.structuredSize();
+ if (Index >= TemplateParams->size())
+ Index = TemplateParams->size() - 1;
+ Info.Param = makeTemplateParameter(TemplateParams->getParam(Index));
return TDK_InvalidExplicitArguments;
}