Arithmetic conversions on operands of different enumeration types are deprecated in C++20 so we need to explicitly cast the operand to the compatible type. Closes #22505.