[cfe-commits] r122928 - /cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
Douglas Gregor
dgregor at apple.com
Wed Jan 5 15:23:17 PST 2011
Author: dgregor
Date: Wed Jan 5 17:23:17 2011
New Revision: 122928
URL: http://llvm.org/viewvc/llvm-project?rev=122928&view=rev
Log:
Fast-path an arity check when performing template argument deduction that compares two parameter-type-lists. 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=122928&r1=122927&r2=122928&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Wed Jan 5 17:23:17 2011
@@ -541,8 +541,12 @@
TemplateDeductionInfo &Info,
llvm::SmallVectorImpl<DeducedTemplateArgument> &Deduced,
unsigned TDF) {
- // FIXME: Fast-path check with NumParams != NumArgs and there are no
- // pack expansions around.
+ // Fast-path check to see if we have too many/too few arguments.
+ if (NumParams != NumArgs &&
+ !(NumParams && isa<PackExpansionType>(Params[NumParams - 1])) &&
+ !(NumArgs && isa<PackExpansionType>(Args[NumArgs - 1])))
+ return NumArgs < NumParams ? Sema::TDK_TooFewArguments
+ : Sema::TDK_TooManyArguments;
// C++0x [temp.deduct.type]p10:
// Similarly, if P has a form that contains (T), then each parameter type
More information about the cfe-commits
mailing list