gcc suppress warning “too small to hold all values of”
问题 I need to use scoped enums so that I can pass them as specific types to our serialiser. I have given explicit integer values for the enum members of Enum1 . I have put two scoped enums matching the description above into a bitfield thus enum class Enum1 { value1 = 0x0, value2 = 0x1, value3 = 0x2 }; enum class Enum2 { value1 = 0x0, value2, value3, // ... value14 }; struct Example { Enum1 value1 : 2; Enum2 value2 : 6; } Now wherever I use the Example type, I get the warning "'Example::value1'