From: Nick Lewycky Date: Tue, 6 May 2014 06:35:27 +0000 (+0000) Subject: Fix crash when one overload candidate is a template instead of a function. Patch... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e539c80b7c1a54b4df0cc53999e676ab4f14271f;p=clang 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 --- 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)