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

Klaus Doldinger klaus.doldinger64@gmail.com
Fri Nov 29 09:18:00 GMT 2019


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).

Thanks,
 Wilhelm



More information about the Gcc-help mailing list