AaronBallman wrote:

> enums should be treated as 'int' types unless explicitly specified (C23) or 
> if 'int' would not be large enough to hold all the enumerated values. In the 
> latter case the compiler is free to choose a suitable integer that would hold 
> all such values.

In C23, the enumeration type is compatible with its underlying type, which is 
either `char` or a standard or extended signed or unsigned integer type (C23 
6.7.2.2p2). The enumeration member type (C23 6.7.2.2p11) is specified by p12 
(when building the enumeration itself) and p15 and p16 (once the enumeration is 
complete). If there's no fixed underlying type, the members are compatible with 
either `int` or the enumerated type, and if there is a fixed underlying type, 
the members type is the enumerated type. Much of this is implementation-defined 
behavior. It sounds like our implementation was assuming compatibility with 
`char` and not `int` because of the aliasing behavior, and now you'd like to 
change it to be `int` so we don't have the aliasing problems?

https://github.com/llvm/llvm-project/pull/73326
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to