Re: Bit-field with std::byte as member type cannot be initialized: bug or feature?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 29 Nov 2019 at 09:18, Klaus Doldinger
<klaus.doldinger64@xxxxxxxxx> wrote:
>
> In C++20 bit-field initializer are possible. But this feature seems
> impossible to use with std::byte.
>
> struct Test {
>     std::byte a : 2 = std::byte{0}; // NOK
>     uint8_t   b : 2 = 0; // OK
> };
>
> Is this intentional or a bug in g++-10 (the version I'm using).

It's a bug (and obviously applies to any scoped enumeration, not just
std::byte).

enum class byte : unsigned char { };
using uint8_t = unsigned char;

struct Test
{
    byte a : 2 = byte{0}; // NOK
    uint8_t   b : 2 = 0; // OK
};

I assume it simply hasn't been implemented yet. Could you please
report it to bugzilla?



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux