[Bug libstdc++/56158] bad enum values computed by operator~ in ios_base.h
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 7 11:40:00 GMT 2013
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.
More information about the Gcc-bugs
mailing list