In C++, enums are permitted to have values other than the explicit enumerators. … After execution falls through the switch statement, it reaches the end of the function without returning a value, which is undefined behavior for a function with a non-void return type.