Earlier quoted context omitted.
That's by design. Consider mapping a file or reinterpret casting a network buffer that contains a structure with such an enum: if has been written by a different version of an application, the possible enum values might be different. That was considered, among other thing, an important use case to support. You can easily build your own safe enum on top of you really want. Edit: someone else pointed out the bitmask us…
I don't think reinterpret casting enums is something that should be encouraged and uncovering such points where unexpected values can be introduced is exactly the point of having a strict enum. Just because putting random values into the enum isn't itself undefined behavior doesn't mean that your program isn't going to blow up later on. Bitmask enums are also a hack and the better solution is to have different types…
> but when enum class was designed there were no existing usages for that.
IIRC diverging from standard enum was considred, but rejected as deemed a surprising change in behaviour.