With the commented out enum clang/gcc give the same results which is the one I want
With the code below (using enum class) gcc gives me the expected results but clang gives me -2
#include <cstdio>
//enum E { A, B, C, D }; // <-- this gets C
enum class E { A, B, C, D }; // <-- this gets -2
struct S { E v : 2; long long i : 30; };
int main() {
S s{E::C, -1};
switch (s.v) {
case E::C: printf("Got C\n"); return 0;
default: printf("Got %d\n", s.v); return 0;
}
}