[Bug c/115729] case label does not reduce to an integer constant

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 1 14:45:55 GMT 2024


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |rejects-valid

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
static const uint64_t MS_D = ((1 << IO_IDX) | (1 << MSD_IDX));

is not a C constant expression (compilers are allowed to accept more, no
diagnostic required).  I think with C23 you can use

constexpr uint64_t MS_D = ((1 << IO_IDX) | (1 << MSD_IDX));

otherwise use enum or #define.


More information about the Gcc-bugs mailing list