[PATCH] libstdc++/77641 fix std::variant for literal types
Jonathan Wakely
jwakely@redhat.com
Wed Sep 21 08:52:00 GMT 2016
On 20/09/16 11:03 -0700, Tim Shen wrote:
>On Mon, Sep 19, 2016 at 1:06 PM, Tim Shen <timshen@google.com> wrote:
>> I believe that it's a "typo" from me - it should be
>> is_trivially_destructible, not is_default_constructible (so that we
>> can avoid using aligned_storage in the corresponding specialization).
>> is_literal_type works, since literal types are trivially destructible.
>
>Sorry I misunderstood your patch.
>
>The underlying problem is that _Variant_storage wasn't always default
>constructible, but it should be.
>
>Jon, your fix doesn't fix the following constexpr variation of your test case:
> struct X {
> constexpr X() { }
> };
>
> constexpr std::variant<X> v1 = X{};
>
>So I have a patch here to make _Variant_storage's internal union
>default constructible.
>
>Tested on x86_64-linux-gnu.
THanks, OK for trunk.
More information about the Libstdc++
mailing list