r208062 - Fix crash when one overload candidate is a template instead of a function. Patch by Kaelyn Takata.

Richard Smith richard at metafoo.co.uk
Tue May 6 00:02:16 PDT 2014


On Mon, May 5, 2014 at 11:35 PM, Nick Lewycky <nicholas at mxc.ca> wrote:

> Author: nicholas
> Date: Tue May  6 01:35:27 2014
> New Revision: 208062
>
> URL: http://llvm.org/viewvc/llvm-project?rev=208062&view=rev
> Log:
> 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.
>
> Modified:
>     cfe/trunk/lib/Sema/SemaOverload.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=208062&r1=208061&r2=208062&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue May  6 01:35:27 2014
> @@ -9260,6 +9260,7 @@ struct CompareOverloadCandidatesForDispl
>            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;
>

What happens if !L->Function && !R->Function? Is this a strict weak order?


>            int LDist = std::abs((int)L->Function->getNumParams() -
> (int)NumArgs);
>            int RDist = std::abs((int)R->Function->getNumParams() -
> (int)NumArgs);
>            if (LDist == RDist)
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140506/847455ad/attachment.html>


More information about the cfe-commits mailing list