https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94566
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Oliver Schönrock from comment #10) > I agree the switch optimisation is better, but... > > shouldn't std::bit_cast prevent incorrect casting with different underlying > implementaion? (ie if the size doesn't match, and the size could be deduced > with TMP) The size can be deduced, yes. What the bits actually mean can't be. > and "unordered value" doesn't apply to std::strong_ordering? Sure, but this PR isn't just about strong_ordering, same problem applies for partial_ordering. And actually not just those, but any case of some set of enumerators or macros where you don't know the values exactly and mapping them to or from a set of integer constants, ideally with 1:1 mapping but not guaranteed that way.