AaronBallman wrote:

> > There's some danger here. _BitInt is a C23 feature as are enumerations with 
> > a fixed underlying type. Enumerations with a fixed underlying type 
> > explicitly disallow using a bit-precise integer type as the underlying 
> > type. See C23 6.7.2.2p4, which says in part, "For all the integer constant 
> > expressions which make up the values of the enumeration constants, there 
> > shall be a type capable of representing all the values that is a standard 
> > or extended signed or unsigned integer type, or char.".
> 
> Thank you for pointing out to this! But it's not clear to me whether this was 
> an explicit decision to not add bit-precise integers here, or just nobody 
> cared enough to push for that. Because use case we have on our hands seems 
> legit to me.

Explicit decision: 
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3030.htm#design-bit.precise.integers
 -- we should add that diagnostic at some point. :-D

The biggest concern I had is that bit-precise integer types do not undergo 
integer promotions, but enumerations do. So it's unclear what the expectations 
are in this case. Should `enum Foo : unsigned _BitInt(8);` promote to `int` 
like `unsigned char` would, or should it not promote like `unsigned _BitInt(8)` 
would?

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

Reply via email to