[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 00:18:25 PDT 2019


On Tuesday, June 18, 2019 11:33 PM, Eric Fiselier <eric at efcs.ca> wrote:

> This commit has caused a large number of compiler failures in Google's codebase.
> I don't think all of them were intended. For example:
> ```
> variant<uint32_t> source6(42);
> ```

This is intended.  A signed literal can
no longer initialize an unsigned
alternative after P0608.

> Could you please roll back so we can further evaluate the impact of this change?

Done.  Please test this diff

  https://reviews.llvm.org/differential/diff/205514/

which includes a patch for case 3 (see below).

> Additionally, could you review the examples I provided and confirm that they
> should break under the new wording?
>
> [1] https://godbolt.org/z/oU9v6U (Abseil's std/absl variant tests)

All the tests failing here are related to
literals; the ConvertVariantTo helper
may need to accept different arguments
for different literals.

> [2] https://godbolt.org/z/-YAaTc (user code in Google)

This is intended and... it looks like
a case where a -Wconversion warning
being hidden by the old variant ctor.

> [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/

^^ this diff for you to read only; it is included
in the previous diff.

/* the problem is that

  https://godbolt.org/z/qQZFn_

testing constexpr ctor breaks out expression
SFINAE.  If you uncomment line 11, you will find
that MSVC continues to work. */

--
Zhihao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190619/bf899a8a/attachment.html>


More information about the libcxx-commits mailing list