[cfe-commits] r122847 - /cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
Douglas Gregor
dgregor at apple.com
Tue Jan 4 14:23:39 PST 2011
Author: dgregor
Date: Tue Jan 4 16:23:38 2011
New Revision: 122847
URL: http://llvm.org/viewvc/llvm-project?rev=122847&view=rev
Log:
Minor cleanups for template argument deduction in the presence of
variadic templates. No functionality change.
Modified:
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=122847&r1=122846&r2=122847&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Tue Jan 4 16:23:38 2011
@@ -1330,17 +1330,11 @@
// C++ [temp.deduct.type]p2:
// [...] or if any template argument remains neither deduced nor
// explicitly specified, template argument deduction fails.
- // FIXME: Variadic templates Empty parameter packs?
llvm::SmallVector<TemplateArgument, 4> Builder;
- for (unsigned I = 0, N = Deduced.size(); I != N; ++I) {
+ TemplateParameterList *PartialParams = Partial->getTemplateParameters();
+ for (unsigned I = 0, N = PartialParams->size(); I != N; ++I) {
if (Deduced[I].isNull()) {
- unsigned ParamIdx = I;
- if (ParamIdx >= Partial->getTemplateParameters()->size())
- ParamIdx = Partial->getTemplateParameters()->size() - 1;
- Decl *Param
- = const_cast<NamedDecl *>(
- Partial->getTemplateParameters()->getParam(ParamIdx));
- Info.Param = makeTemplateParameter(Param);
+ Info.Param = makeTemplateParameter(PartialParams->getParam(I));
return Sema::TDK_Incomplete;
}
@@ -3294,7 +3288,6 @@
Deduced.clear();
Deduced.resize(TemplateParams->size());
- // FIXME: Variadic templates.
FunctionDecl *Function = FunctionTemplate->getTemplatedDecl();
for (unsigned I = 0, N = Function->getNumParams(); I != N; ++I)
::MarkUsedTemplateParameters(*this, Function->getParamDecl(I)->getType(),
More information about the cfe-commits
mailing list