https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85714
--- Comment #3 from Thomas Otto <thomas.o...@pdv-fs.de> --- I thought forcing out-of-range enum values is no longer unspecified but now undefined behavior in C++17: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1766 http://obiwahn.org/c++draft/expr.static.cast/#10 > The value is unchanged if the original value is within the range of the > enumeration values ([dcl.enum]). Otherwise, the behavior is undefined. And this warning also shows up with -std=c++17