https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94535
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Why not do this: static_assert(X == 3 || X == 4); There that works for both cases. --- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Why not do this: static_assert(X == 3 || X == 4); There that works for both cases.