Does not need to be portable. As long as it works for one compiler, I can make an ifdef to enable it only on that compiler. I'd prefer a GCC solution but any compiler is fine. I'm using C99.
For context, I'm trying to pack some data together into 32 bits, and one of the fields I'm packing, which I want to represent with an enum, should be only 7 bits wide. If I make it bigger than 7 bits, I'll lose one of the bits, so I'd like a compiler error if I define an enum value that can't fit in 7 bits.