diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 1e72a3b5..7412f0dd 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -128,12 +128,6 @@ FMT_FUNC std::system_error vsystem_error(int error_code, string_view format_str, namespace detail { -#if __cplusplus < 201703L -template constexpr uint64_t basic_data::pow10_significands[]; -template constexpr int16_t basic_data::pow10_exponents[]; -template constexpr uint64_t basic_data::power_of_10_64[]; -#endif - template inline bool operator==(basic_fp x, basic_fp y) { return x.f == y.f && x.e == y.e; } diff --git a/include/fmt/format.h b/include/fmt/format.h index 71f59c9c..dd0df5d9 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1511,6 +1511,12 @@ template struct basic_data { 10000000000000000000ULL}; }; +#if __cplusplus < 201703L +template constexpr uint64_t basic_data::pow10_significands[]; +template constexpr int16_t basic_data::pow10_exponents[]; +template constexpr uint64_t basic_data::power_of_10_64[]; +#endif + // This is a struct rather than an alias to avoid shadowing warnings in gcc. struct data : basic_data<> {}; diff --git a/test/format-test.cc b/test/format-test.cc index c8779e32..7a859838 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1982,6 +1982,10 @@ TEST(format_test, to_string) { enum foo : unsigned char { zero }; EXPECT_EQ(fmt::to_string(zero), "0"); + +#if FMT_USE_FLOAT128 + EXPECT_EQ(fmt::to_string(__float128(0.42)), "0.42"); +#endif } TEST(format_test, output_iterators) {