http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56158
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-07 11:39:31 UTC --- I think since 4.6 the default behaviour (i.e. without -fstrict-enums) is safe. With -fstrict-enums (or in releases before 4.6) the optimisers can assume that no invalid values are ever produced, so Enum(~static_cast<int>(e)) has undefined behaviour as Richard says.