GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc Performance Win

C: Implement bit-precise enums as specified in C2Y N3705

This commit implements bit-precise enums as defined in C2Y N3705.

This commit implements the bit-precise enum feature from the C2Y draft standard (N3705). It enables the use of _BitInt(N) types as the underlying type for enums when compiling with -std=c2y or -std=gnu2y. The implementation adjusts the BITINT_TYPE_P macro and modifies related code to handle enums with bit-precise underlying types seamlessly, including conversions and bit-field promotions.

In Details

Implements C2Y N3705 bit-precise enums. Extends c_parser_enum_specifier to allow _BitInt(N) as the underlying type for enums. Adjusts BITINT_TYPE_P macro and related code in tree.h, stor-layout.cc, and gimple-lower-bitint.cc to handle these enums, including conversions and bit-field promotions according to WG14 issue 1021.

For Context

This commit introduces a new feature to the C language within GCC: bit-precise enums. Enums, or enumerations, are a way to define a variable that can only take on a specific set of named values. Bit-precise enums allow you to specify the exact number of bits used to store these values, potentially saving memory and improving performance. This new feature is part of the upcoming C2Y standard, offering developers greater control over data representation.

Filed Under: cc2yenumsbitint