<div>On Wednesday, June 19, 2019 1:19 PM, Eric Fiselier <eric@efcs.ca> wrote: <br></div><blockquote class="protonmail_quote" type="cite"><div dir="ltr"><div class="gmail_quote"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><blockquote type="cite" class="gmail-m_-4512188178130762814protonmail_quote"><div dir="ltr"><div><div>[3] <a target="_blank" href="https://godbolt.org/z/YW_aSU">https://godbolt.org/z/YW_aSU</a> (another example of broken user code)<br></div></div></div></blockquote><div><br></div><div><div>This is not intended.  It is caused by a<br></div><div>bug in Clang.  I've made a patch to<br></div><div>workaround it in libc++<br></div><div><br></div><div>  <a target="_blank" href="https://reviews.llvm.org/differential/diff/205513/">https://reviews.llvm.org/differential/diff/205513/</a><br></div></div></blockquote></div></div></blockquote><div><br></div><div>It turns out that the fix is a bad idea; it<br></div><div>happens to work because of a bug,<br></div><div>the behavior without the fix is required<br></div><div>by the standard and is defendable.<br></div><div><br></div><div>I thought the original behavior is a bug<br></div><div>and filed a ticket,<br></div><div><br></div><div>  <a href="https://bugs.llvm.org/show_bug.cgi?id=42330">https://bugs.llvm.org/show_bug.cgi?id=42330</a><br></div><div><br></div><div>Richard explained that the seemly strange<br></div><div>behavior -- adding/removing constexpr<br></div><div>causes list-initialization to check differently<br></div><div>in expression sfinae -- is legit.  So given the<br></div><div>knowledge of "compiler needs to evaluate<br></div><div>constexpr ctor for narrowing check, therefore<br></div><div>instantiates template," I now think that this<br></div><div>constructor in the original case<br></div><div><br></div><div>  template <class U><br></div><div>  constexpr MyPtr(MyPtr<U>&& v) : ptr_(v.ptr_.release()) {}<br></div><div><br></div><div>is just not sfinae-friendly.  Constraining it fixes<br></div><div>the breakage:<br></div><div><br></div><div>  <a href="https://godbolt.org/z/nfhkhG">https://godbolt.org/z/nfhkhG</a><br></div><div><br></div><div>So I would suggest to test against the original<br></div><div>commit instead:<br></div><div><br></div><div>  <a href="https://reviews.llvm.org/rL363692">https://reviews.llvm.org/rL363692</a> </div><div><br></div><div>:/<br></div><div><br></div><div class="protonmail_signature_block"><div class="protonmail_signature_block-user"><div><div class="protonmail_signature_block"><div class="protonmail_signature_block-user"><div>--<br></div><div><span>Zhihao Yuan, ID lichray<br>The best way to predict the future is to invent it.<br>_______________________________________________</span></div></div><div class="protonmail_signature_block-proton protonmail_signature_block-empty"><div><br></div></div></div></div></div></div><div><br></div>