<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div>
<meta content="text/html; charset=us-ascii" data-ogsc="" style="">
</div>
<div dir="auto" style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255); text-align: left;">
Right. I was just bringing Richard's reply to Hans' attention, to make sure he saw that the new behavior was correct and there were no concerns here for the 10.0 release. </div>
<div id="ms-outlook-mobile-signature" data-ogsc="" style="text-align: left;" dir="auto">
<div><br>
</div>
</div>
<hr tabindex="-1" style="display: inline-block; width: 98%;" data-ogsc="">
<div id="divRplyFwdMsg" dir="ltr" data-ogsc="" style=""><font face="Calibri, sans-serif" color="#000000" style="font-size: 11pt;" data-ogsc=""><b>From:</b> Robinson, Paul <paul.robinson@sony.com><br>
<b>Sent:</b> Monday, March 9, 2020 5:38:45 AM<br>
<b>To:</b> Shoaib Meenai <smeenai@fb.com>; richard@metafoo.co.uk <richard@metafoo.co.uk><br>
<b>Cc:</b> David Blaikie <dblaikie@gmail.com>; cfe-dev@lists.llvm.org <cfe-dev@lists.llvm.org>; Hans Wennborg <hans@chromium.org><br>
<b>Subject:</b> RE: [cfe-dev] Q on patch for CWG 2352</font>
<div> </div>
</div>
<style data-ogsc="" style="">
<!--
@font-face
        {font-family:Wingdings}
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p.x_MsoListParagraph, li.x_MsoListParagraph, div.x_MsoListParagraph
        {margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
p.x_msonormal0, li.x_msonormal0, div.x_msonormal0
        {margin-right:0in;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
span.x_EmailStyle18
        {font-family:"Calibri",sans-serif;
        color:windowtext}
span.x_EmailStyle20
        {font-family:"Calibri",sans-serif;
        color:windowtext}
.x_MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:1.0in 1.0in 1.0in 1.0in}
ol
        {margin-bottom:0in}
ul
        {margin-bottom:0in}
-->
</style>
<div lang="EN-US" data-ogsc="" style="">
<div class="x_WordSection1">
<p class="x_MsoNormal">> +Hans for 10.0 visibility.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">The new (corrected) behavior is in 10.0, there is nothing to fix here.  Arguably there could be a release note.</p>
<p class="x_MsoNormal">--paulr</p>
<p class="x_MsoNormal"> </p>
<div style="border:none; border-left:solid blue 1.5pt; padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal"><b>From:</b> Shoaib Meenai <smeenai@fb.com> <br>
<b>Sent:</b> Friday, March 6, 2020 7:35 PM<br>
<b>To:</b> richard@metafoo.co.uk; Robinson, Paul <paul.robinson@sony.com><br>
<b>Cc:</b> David Blaikie <dblaikie@gmail.com>; cfe-dev@lists.llvm.org; Hans Wennborg <hans@chromium.org><br>
<b>Subject:</b> Re: [cfe-dev] Q on patch for CWG 2352</p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">+Hans for 10.0 visibility.</p>
<p class="x_MsoNormal"> </p>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal"><b><span style="font-size: 12pt; color: black;">From: </span>
</b><span style="font-size: 12pt; color: black;">Richard Smith <<a href="mailto:richard@metafoo.co.uk" data-ogsc="" style="">richard@metafoo.co.uk</a>><br>
<b>Reply-To: </b>"<a href="mailto:richard@metafoo.co.uk" data-ogsc="" style="">richard@metafoo.co.uk</a>" <<a href="mailto:richard@metafoo.co.uk" data-ogsc="" style="">richard@metafoo.co.uk</a>><br>
<b>Date: </b>Friday, March 6, 2020 at 4:28 PM<br>
<b>To: </b>"Robinson, Paul" <<a href="mailto:paul.robinson@sony.com" data-ogsc="" style="">paul.robinson@sony.com</a>><br>
<b>Cc: </b>Shoaib Meenai <<a href="mailto:smeenai@fb.com" data-ogsc="" style="">smeenai@fb.com</a>>, David Blaikie <<a href="mailto:dblaikie@gmail.com" data-ogsc="" style="">dblaikie@gmail.com</a>>, cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" data-ogsc="" style="">cfe-dev@lists.llvm.org</a>><br>
<b>Subject: </b>Re: [cfe-dev] Q on patch for CWG 2352</span></p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<div>
<p class="x_MsoNormal">On Thu, 5 Mar 2020 at 11:41, Robinson, Paul via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" data-ogsc="" style="">cfe-dev@lists.llvm.org</a>> wrote:</p>
</div>
<div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0in 0in 0in 6.0pt; margin-left:4.8pt; margin-top:5.0pt; margin-right:0in; margin-bottom:5.0pt">
<p class="x_MsoNormal">> Richard Smith made a patch in f041e9ad for CWG2352.<br>
> As a consequence of this patch, we had an obscure test failure,<br>
> and it's not clear to me that it's an intentional consequence.<br>
> So I figured I'd ask here.<br>
><br>
> Reduced test case:<br>
<br>
Slightly edited and expanded test case:<br>
<br>
bool foo(void * const * const *       &&) { return false; } // new choice<br>
bool foo(void *       * const * const &)  { return true; }  // old choice<br>
bool bar() {<br>
 return foo(reinterpret_cast<void***>(2));<br>
}</p>
</blockquote>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal">I'm not entirely sure how we were coming up with the old answer, but the new answer is correct: binding an rvalue reference to an rvalue is preferred over binding an lvalue reference.</p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0in 0in 0in 6.0pt; margin-left:4.8pt; margin-top:5.0pt; margin-right:0in; margin-bottom:5.0pt">
<p class="x_MsoNormal">// A couple of additional cases:<br>
void*** p;<br>
void*** q() { return p; }<br>
bool func1() { return foo(p); } // old and new both call '&' overload<br>
bool func2() { return foo(q()); } // old calls '&', new calls '&&'</p>
</blockquote>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal">Here, q() is an rvalue, so we prefer binding an rvalue reference. p is an lvalue, so that rule doesn't apply and we prefer binding the lvalue reference because it binds to a less-qualified type.</p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal">I believe the new Clang behavior is following the rules described in C++ [over.ics.rank] paragraph 3.</p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0in 0in 0in 6.0pt; margin-left:4.8pt; margin-top:5.0pt; margin-right:0in; margin-bottom:5.0pt">
<p class="x_MsoNormal">So it looks like it matters whether the argument is an expression?<br>
--paulr<br>
<br>
<br>
> Prior to the patch, the compiler selected the second overload;<br>
> after the patch, it selects the first overload.  Apparently there's<br>
> some subtle difference in the preferred-ness of one over the other,<br>
> and AFAICT the const-nesses aren't supposed to factor in any more?<br>
> so it's about the &-ref versus the &&-ref?<br>
><br>
> As I said, mainly I want to make sure this was intentional; if it<br>
> is, we can fiddle our test and that's the end of it.  But if it's<br>
> not intentional, this change is in the almost-final Clang 10.0<br>
> release, and might want to be fixed before it goes out.<br>
><br>
> Thanks,<br>
> --paulr<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" data-ogsc="" style="">cfe-dev@lists.llvm.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Ddev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=ypmPfXfKC2Dzmek68WWseeMwGZvv18RMduMOIPY1Plc&s=872P1W35_a99gl6FhfNvVJzNWhiLZIs8FwP9QyWcbsM&e=" target="_blank" data-ogsc="" style="">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Robinson, Paul <paul.robinson@sony.com><br>
<b>Sent:</b> Monday, March 9, 2020 5:38:45 AM<br>
<b>To:</b> Shoaib Meenai <smeenai@fb.com>; richard@metafoo.co.uk <richard@metafoo.co.uk><br>
<b>Cc:</b> David Blaikie <dblaikie@gmail.com>; cfe-dev@lists.llvm.org <cfe-dev@lists.llvm.org>; Hans Wennborg <hans@chromium.org><br>
<b>Subject:</b> RE: [cfe-dev] Q on patch for CWG 2352</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:Wingdings}
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p.x_MsoListParagraph, li.x_MsoListParagraph, div.x_MsoListParagraph
        {margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
p.x_msonormal0, li.x_msonormal0, div.x_msonormal0
        {margin-right:0in;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
span.x_EmailStyle18
        {font-family:"Calibri",sans-serif;
        color:windowtext}
span.x_EmailStyle20
        {font-family:"Calibri",sans-serif;
        color:windowtext}
.x_MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:1.0in 1.0in 1.0in 1.0in}
div.x_WordSection1
        {}
ol
        {margin-bottom:0in}
ul
        {margin-bottom:0in}
-->
</style>
<div lang="EN-US" link="blue" vlink="purple">
<div class="x_WordSection1">
<p class="x_MsoNormal">> +Hans for 10.0 visibility.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">The new (corrected) behavior is in 10.0, there is nothing to fix here.  Arguably there could be a release note.</p>
<p class="x_MsoNormal">--paulr</p>
<p class="x_MsoNormal"> </p>
<div style="border:none; border-left:solid blue 1.5pt; padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal"><b>From:</b> Shoaib Meenai <smeenai@fb.com> <br>
<b>Sent:</b> Friday, March 6, 2020 7:35 PM<br>
<b>To:</b> richard@metafoo.co.uk; Robinson, Paul <paul.robinson@sony.com><br>
<b>Cc:</b> David Blaikie <dblaikie@gmail.com>; cfe-dev@lists.llvm.org; Hans Wennborg <hans@chromium.org><br>
<b>Subject:</b> Re: [cfe-dev] Q on patch for CWG 2352</p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">+Hans for 10.0 visibility.</p>
<p class="x_MsoNormal"> </p>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal"><b><span style="font-size:12.0pt; color:black">From: </span>
</b><span style="font-size:12.0pt; color:black">Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>><br>
<b>Reply-To: </b>"<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>" <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>><br>
<b>Date: </b>Friday, March 6, 2020 at 4:28 PM<br>
<b>To: </b>"Robinson, Paul" <<a href="mailto:paul.robinson@sony.com">paul.robinson@sony.com</a>><br>
<b>Cc: </b>Shoaib Meenai <<a href="mailto:smeenai@fb.com">smeenai@fb.com</a>>, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>>, cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>><br>
<b>Subject: </b>Re: [cfe-dev] Q on patch for CWG 2352</span></p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<div>
<p class="x_MsoNormal">On Thu, 5 Mar 2020 at 11:41, Robinson, Paul via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:</p>
</div>
<div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0in 0in 0in 6.0pt; margin-left:4.8pt; margin-top:5.0pt; margin-right:0in; margin-bottom:5.0pt">
<p class="x_MsoNormal">> Richard Smith made a patch in f041e9ad for CWG2352.<br>
> As a consequence of this patch, we had an obscure test failure,<br>
> and it's not clear to me that it's an intentional consequence.<br>
> So I figured I'd ask here.<br>
><br>
> Reduced test case:<br>
<br>
Slightly edited and expanded test case:<br>
<br>
bool foo(void * const * const *       &&) { return false; } // new choice<br>
bool foo(void *       * const * const &)  { return true; }  // old choice<br>
bool bar() {<br>
 return foo(reinterpret_cast<void***>(2));<br>
}</p>
</blockquote>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal">I'm not entirely sure how we were coming up with the old answer, but the new answer is correct: binding an rvalue reference to an rvalue is preferred over binding an lvalue reference.</p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0in 0in 0in 6.0pt; margin-left:4.8pt; margin-top:5.0pt; margin-right:0in; margin-bottom:5.0pt">
<p class="x_MsoNormal">// A couple of additional cases:<br>
void*** p;<br>
void*** q() { return p; }<br>
bool func1() { return foo(p); } // old and new both call '&' overload<br>
bool func2() { return foo(q()); } // old calls '&', new calls '&&'</p>
</blockquote>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal">Here, q() is an rvalue, so we prefer binding an rvalue reference. p is an lvalue, so that rule doesn't apply and we prefer binding the lvalue reference because it binds to a less-qualified type.</p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<div>
<p class="x_MsoNormal">I believe the new Clang behavior is following the rules described in C++ [over.ics.rank] paragraph 3.</p>
</div>
<div>
<p class="x_MsoNormal"> </p>
</div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0in 0in 0in 6.0pt; margin-left:4.8pt; margin-top:5.0pt; margin-right:0in; margin-bottom:5.0pt">
<p class="x_MsoNormal">So it looks like it matters whether the argument is an expression?<br>
--paulr<br>
<br>
<br>
> Prior to the patch, the compiler selected the second overload;<br>
> after the patch, it selects the first overload.  Apparently there's<br>
> some subtle difference in the preferred-ness of one over the other,<br>
> and AFAICT the const-nesses aren't supposed to factor in any more?<br>
> so it's about the &-ref versus the &&-ref?<br>
><br>
> As I said, mainly I want to make sure this was intentional; if it<br>
> is, we can fiddle our test and that's the end of it.  But if it's<br>
> not intentional, this change is in the almost-final Clang 10.0<br>
> release, and might want to be fixed before it goes out.<br>
><br>
> Thanks,<br>
> --paulr<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Ddev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=ypmPfXfKC2Dzmek68WWseeMwGZvv18RMduMOIPY1Plc&s=872P1W35_a99gl6FhfNvVJzNWhiLZIs8FwP9QyWcbsM&e=" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</body>
</html>