[libcxx-commits] [libcxx] r363692 - [libc++] Implement P0608R3 - A sane variant converting constructor

Zhihao Yuan via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 19 15:58:26 PDT 2019


On Wednesday, June 19, 2019 1:19 PM, Eric Fiselier <eric at efcs.ca> wrote:

>>> [3] https://godbolt.org/z/YW_aSU (another example of broken user code)
>>
>> This is not intended.  It is caused by a
>> bug in Clang.  I've made a patch to
>> workaround it in libc++
>>
>>   https://reviews.llvm.org/differential/diff/205513/

It turns out that the fix is a bad idea; it
happens to work because of a bug,
the behavior without the fix is required
by the standard and is defendable.

I thought the original behavior is a bug
and filed a ticket,

  https://bugs.llvm.org/show_bug.cgi?id=42330

Richard explained that the seemly strange
behavior -- adding/removing constexpr
causes list-initialization to check differently
in expression sfinae -- is legit.  So given the
knowledge of "compiler needs to evaluate
constexpr ctor for narrowing check, therefore
instantiates template," I now think that this
constructor in the original case

  template <class U>
  constexpr MyPtr(MyPtr<U>&& v) : ptr_(v.ptr_.release()) {}

is just not sfinae-friendly.  Constraining it fixes
the breakage:

  https://godbolt.org/z/nfhkhG

So I would suggest to test against the original
commit instead:

  https://reviews.llvm.org/rL363692

:/

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190619/27616bf5/attachment-0001.html>


More information about the libcxx-commits mailing list