ojhunt wrote:
> (while too lazy to godbolt right now)
Given I basically wrote the entire example, I thought I would just do the
godbolting, and lo
```cpp
enum class Enum {
A, B, C, D
};
struct S {
Enum e: 1; // I'm a rockstar developer and "know" that I'll only ever assign
A or B here
};
void f(bool x) {
S s;
if (x)
s.e = Enum::A;
else
s.e = Enum::B;
}
```
Compiles cleanly with `-Wbitfield-width -Wbitfield-enum-conversion`:
https://godbolt.org/z/a1fErxv74
https://github.com/llvm/llvm-project/pull/116785
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits