Reputation: 21
I've been happily compiling my code with GCC without issue for the past three months until I rebuilt my cross-compiler, which was when I found myself getting the message "error: bit-field '...' with non-integral type".
An example of an offending enum is below:
typedef unsigned char byte;
enum class opStatus : byte
{
/* Process has yet to begin execution */
Ready,
/* Process can resume execution */
Started,
/* Process has completed */
Finished,
/* Process is handling shutdown */
Finishing,
};
struct // Example usage
{
opStatus Status : 2;
};
Why is this happening?
Upvotes: 2
Views: 1188
Reputation: 3106
Make the bitwidth 8. Its a byte after all.
Once I did that (and added a name for the struct),
g++ -std=c++11
didn't give me any warning or error.
Upvotes: 1