<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 6, 2014 at 12:02 AM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=richard@metafoo.co.uk&cc=&bcc=&su=&body=','_blank');return false;" class="cremed">richard@metafoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div class="">On Mon, May 5, 2014 at 11:35 PM, Nick Lewycky <span dir="ltr"><<a href="mailto:nicholas@mxc.ca" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=nicholas@mxc.ca&cc=&bcc=&su=&body=','_blank');return false;" class="cremed">nicholas@mxc.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Author: nicholas<br>
Date: Tue May  6 01:35:27 2014<br>
New Revision: 208062<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=208062&view=rev" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=208062&view=rev</a><br>
Log:<br>
Fix crash when one overload candidate is a template instead of a function. Patch by Kaelyn Takata.<br>
<br>
Testcase coming out of creduce will land in a separate commit shortly.<br>
<br>
Also, it appears that this callback is used even in a SFINAE context where the results are never displayed.<br>
<br>
Modified:<br>
    cfe/trunk/lib/Sema/SemaOverload.cpp<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=208062&r1=208061&r2=208062&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=208062&r1=208061&r2=208062&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue May  6 01:35:27 2014<br>
@@ -9260,6 +9260,7 @@ struct CompareOverloadCandidatesForDispl<br>
           L->FailureKind == ovl_fail_too_few_arguments) {<br>
         if (R->FailureKind == ovl_fail_too_many_arguments ||<br>
             R->FailureKind == ovl_fail_too_few_arguments) {<br>
+          if (!L->Function || !R->Function) return !R->Function;<br></blockquote><div><br></div></div><div>What happens if !L->Function && !R->Function? Is this a strict weak order?</div></div></div>
</div></blockquote><div><br></div>If  !L->Function && !R->Function then L will be ordered before R. This isn't a strict weak order in that if you transpose L and R then the original R would be ordered before the original L, but that was true prior to my adding the parameter-count based sorting (when false was always returned for L if it had too few or too many arguments, regardless of what R was).</div>
<div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">
<div class="gmail_quote"><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

           int LDist = std::abs((int)L->Function->getNumParams() - (int)NumArgs);<br>
           int RDist = std::abs((int)R->Function->getNumParams() - (int)NumArgs);<br>
           if (LDist == RDist)<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=cfe-commits@cs.uiuc.edu&cc=&bcc=&su=&body=','_blank');return false;" class="cremed">cfe-commits@cs.uiuc.edu</a><br>

<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div><br></div></div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=cfe-commits@cs.uiuc.edu&cc=&bcc=&su=&body=','_blank');return false;" class="cremed">cfe-commits@cs.uiuc.edu</a><br>

<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div>