[Bug c++/92732] Bit-field of scoped enumeration type cannot be initialized
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92732 Jakub Jelinek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED Target Milestone|--- |8.4 --- Comment #7 from Jakub Jelinek --- Fixed for 8.4+ and 9.3+ too.
[Bug c++/92732] Bit-field of scoped enumeration type cannot be initialized
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92732 --- Comment #6 from CVS Commits --- The releases/gcc-8 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:41e5eec55cb64b54c717d9625bcee1aac1def569 commit r8-9991-g41e5eec55cb64b54c717d9625bcee1aac1def569 Author: Jakub Jelinek Date: Fri Feb 14 12:58:46 2020 +0100 backport: re PR c++/92732 (Bit-field of scoped enumeration type cannot be initialized) Backported from mainline 2019-12-03 Jakub Jelinek PR c++/92732 * typeck2.c (digest_nsdmi_init): For bitfields, use DECL_BIT_FIELD_TYPE instead of TREE_TYPE. * g++.dg/cpp2a/bitfield3.C: Don't expect narrowing conversion warnings. * g++.dg/cpp2a/bitfield4.C: New test.
[Bug c++/92732] Bit-field of scoped enumeration type cannot be initialized
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92732 --- Comment #5 from Jakub Jelinek --- Author: jakub Date: Fri Dec 20 17:34:14 2019 New Revision: 279665 URL: https://gcc.gnu.org/viewcvs?rev=279665&root=gcc&view=rev Log: Backported from mainline 2019-12-03 Jakub Jelinek PR c++/92732 * typeck2.c (digest_nsdmi_init): For bitfields, use DECL_BIT_FIELD_TYPE instead of TREE_TYPE. * g++.dg/cpp2a/bitfield3.C: Don't expect narrowing conversion warnings. * g++.dg/cpp2a/bitfield4.C: New test. Added: branches/gcc-9-branch/gcc/testsuite/g++.dg/cpp2a/bitfield4.C Modified: branches/gcc-9-branch/gcc/cp/ChangeLog branches/gcc-9-branch/gcc/cp/typeck2.c branches/gcc-9-branch/gcc/testsuite/ChangeLog branches/gcc-9-branch/gcc/testsuite/g++.dg/cpp2a/bitfield3.C
[Bug c++/92732] Bit-field of scoped enumeration type cannot be initialized
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92732 --- Comment #4 from Jakub Jelinek --- Should be fixed on the trunk now, queued for backporting to 9 and 8 branches.
[Bug c++/92732] Bit-field of scoped enumeration type cannot be initialized
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92732 --- Comment #3 from Jakub Jelinek --- Author: jakub Date: Tue Dec 3 08:21:29 2019 New Revision: 278923 URL: https://gcc.gnu.org/viewcvs?rev=278923&root=gcc&view=rev Log: PR c++/92732 * typeck2.c (digest_nsdmi_init): For bitfields, use DECL_BIT_FIELD_TYPE instead of TREE_TYPE. * g++.dg/cpp2a/bitfield3.C: Don't expect narrowing conversion warnings. * g++.dg/cpp2a/bitfield4.C: New test. Added: trunk/gcc/testsuite/g++.dg/cpp2a/bitfield4.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/typeck2.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/cpp2a/bitfield3.C
[Bug c++/92732] Bit-field of scoped enumeration type cannot be initialized
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92732 Jakub Jelinek changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek --- Created attachment 47399 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47399&action=edit gcc10-pr92732.patch Untested fix.
[Bug c++/92732] Bit-field of scoped enumeration type cannot be initialized
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92732 Jonathan Wakely 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 --- 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