Be more careful about picking a template parameter when we fail to substitute explicit template arguments into a function template

llvm-svn: 103369
This commit is contained in:
Douglas Gregor 2010-05-09 01:26:06 +00:00
parent e0b5b3a1c5
commit 62c281a873
1 changed files with 4 additions and 2 deletions

View File

@ -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;
}