https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92732
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2019-11-29
Summary|Bit-field with std::byte as |Bit-field of scoped
|member type cannot be |enumeration type cannot be
|initialized |initialized
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is not a complete testcase, it's missing the relevant headers. I already
provided a reduced testcase on the mailing list (and explained that the problem
is not specific to 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
};
bf.cc:6:18: error: cannot convert 'byte' to 'unsigned char:2' in initialization
6 | byte a : 2 = byte{0}; // NOK
| ^~~~~~~
| |
| byte