Annex F (informative) Core undefined behavior [ub]

F.3 [expr]: Expressions [ub.expr]

F.3.16[ub:expr.static.cast.enum.outside.range]
Specified in: [expr.static.cast]

If the enumeration type does not have a fixed underlying type, the value is unchanged if the original value is within the range of the enumeration values ([dcl.enum]), and otherwise, the behavior is undefined.
[Example 1: enum A { e1 = 1, e2 }; void f() { enum A a = static_cast<A>(4); // undefined behavior, 4 is not within the range of enumeration values } — end example]