https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104175
Bug ID: 104175 Summary: Enum Class Bit Fields Brace-enclosed Initializer List fails to compile Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bieri.hp at gmail dot com Target Milestone: --- When using Enum Class Bit Fields brace-enclosed Initializer list fails to compile, whereas with clang it does compile. I am not sure what the standard demands but it seems reasonable that it compiles. #include <cstdint> enum class EC: uint8_t { E1, E2, E3, E4 }; struct SEC { EC ec1:2 = EC::E4; }; struct S { uint8_t a1:2 = 3; }; void funcSEC( SEC sec) {} void funcS( S s) {} int main() { funcS( { .a1 = 3}); funcSEC( { .ec1 = EC::E2}); // error: could not convert '{EC::E2}' from '<brace-enclosed initializer list>' to 'SEC' funcSEC( SEC { .ec1 = EC::E2}); // ok }