https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92732

            Bug ID: 92732
           Summary: Bit-field with std::byte as member type cannot be
                    initialized
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: klaus.doldinger64 at googlemail dot com
  Target Milestone: ---

Since C++20 bit-field initializer are possible. 

There seems to be a bug with std::byte an bit-fields.

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

Compiling this with

g++ (GCC) 10.0.0 20191128 (experimental)

yields:

test93.cc:20:28: error: cannot convert 'std::byte' to 'unsigned char:2' in
initialization
   20 |     std::byte a : 2 = std::byte{0}; // NOK
      |                            ^~~~~~~
      |                            |
      |                            std::byte

Reply via email to