diff --git a/include/fmt/core.h b/include/fmt/core.h index 36c92f667086..ee42d0c8b107 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -2029,14 +2029,20 @@ template class basic_format_args { // between clang and gcc on ARM (#1919). using format_args = basic_format_args; -// We cannot use enum classes as bit fields because of a gcc bug +// We cannot use enum classes as bit fields because of a gcc bug before 9.3 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414. +#if FMT_GCC_VERSION && FMT_GCC_VERSION < 903 +# define FMT_ENUM_UNDERLYING_TYPE(type) +#else +# define FMT_ENUM_UNDERLYING_TYPE(type) : type +#endif + namespace align { -enum type { none, left, right, center, numeric }; +enum type FMT_ENUM_UNDERLYING_TYPE(unsigned char) { none, left, right, center, numeric }; } using align_t = align::type; namespace sign { -enum type { none, minus, plus, space }; +enum type FMT_ENUM_UNDERLYING_TYPE(unsigned char) { none, minus, plus, space }; } using sign_t = sign::type;