[Bug c++/96496] Conversion to enum with underlying type bool produces wrong result

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Aug 1 00:17:07 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96496

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed (again with a compile time test):
enum E : bool { One, Two };
constexpr int f1 (int x) { return (E) x; }
static_assert(f1(6), "");
static_assert(f1(7), "");


More information about the Gcc-bugs mailing list