struct S {
enum E : unsigned char { E0, E1, E2, E3 };
E e : 1; // warn here
};
S::E f(S::E e) {
S s{};
s.e = e;
//s.e = S::E3; // [clang-diagnostic-bitfield-constant-conversion]
return s.e;
}
int main() {
return f(S::E3);
}
Not sure if this is appropriate for clang-tidy or diagnostics.
GCC shows a warning.
https://godbolt.org/z/WTnPYTrz7