summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2014-05-06 06:35:27 +0000
committerNick Lewycky <nicholas@mxc.ca>2014-05-06 06:35:27 +0000
commite539c80b7c1a54b4df0cc53999e676ab4f14271f (patch)
tree678d752b0ddc53a59d26bce17ab2aa1130447e92
parent9292dbd49443621fad5e63ec530bc136561294cd (diff)
Fix crash when one overload candidate is a template instead of a function. Patch by Kaelyn Takata.
Testcase coming out of creduce will land in a separate commit shortly. Also, it appears that this callback is used even in a SFINAE context where the results are never displayed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208062 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaOverload.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 70f5dba56d..7f9e0ecd96 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -9260,6 +9260,7 @@ struct CompareOverloadCandidatesForDisplay {
L->FailureKind == ovl_fail_too_few_arguments) {
if (R->FailureKind == ovl_fail_too_many_arguments ||
R->FailureKind == ovl_fail_too_few_arguments) {
+ if (!L->Function || !R->Function) return !R->Function;
int LDist = std::abs((int)L->Function->getNumParams() - (int)NumArgs);
int RDist = std::abs((int)R->Function->getNumParams() - (int)NumArgs);
if (LDist == RDist)