Endilll wrote:
@erichkeane I guess you'd be pretty happy if our enums were declared the
following way:
```cpp
enum E : unsigned _BitInt(4) {
e0 = 16,
};
```
Then you'd be warned on the spot if you have more values than bits can hold,
and bit-fields side check would be trivial to implement:
```
<source>:3:8: error: enumerator value evaluates to 16, which cannot be narrowed
to type 'unsigned _BitInt(4)' [-Wc++11-narrowing]
e0 = 16,
```
Unfortunately, Clang 14+ is the only major implementation that accepts this:
https://godbolt.org/z/9rn87d8hc
https://github.com/llvm/llvm-project/pull/69104
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits