Issue |
138449
|
Summary |
enum and enum class give different values with bit field
|
Labels |
new issue
|
Assignees |
|
Reporter |
LevoDeLellis
|
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;
}
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs