aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-05 23:23:17 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-05 23:23:17 +0000
commit0bbacf8d2b3c7a5f19f292f3201e371836445502 (patch)
treefe5b75db96d127c771c249c8bad8c3d3185b0e6d /lib
parentc8a16fbb78c0e0ae2d2ebdb00bd6761d9d6714d2 (diff)
Fast-path an arity check when performing template argument deduction that compares two parameter-type-lists. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122928 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index e762d34117..603a7efea5 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -541,8 +541,12 @@ DeduceTemplateArguments(Sema &S,
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