diff --git a/include/fmt/format.h b/include/fmt/format.h index 82ddb407d098..08ee57d970c0 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -579,9 +579,10 @@ inline auto code_point_index(basic_string_view s, size_t n) return s.size(); } -template -using is_fast_float = bool_constant::is_iec559 && - sizeof(T) <= sizeof(double)>; +template ::value> +struct is_fast_float : bool_constant::is_iec559 && + sizeof(T) <= sizeof(double)> {}; +template struct is_fast_float : std::false_type {}; #ifndef FMT_USE_FULL_CACHE_DRAGONBOX # define FMT_USE_FULL_CACHE_DRAGONBOX 0 diff --git a/test/ostream-test.cc b/test/ostream-test.cc index 62db0f53f768..b0dd3c4b26dd 100644 --- a/test/ostream-test.cc +++ b/test/ostream-test.cc @@ -23,6 +23,7 @@ template <> struct formatter : formatter { #include +#include "fmt/compile.h" #include "fmt/ostream.h" #include "fmt/ranges.h" #include "gmock/gmock.h" @@ -280,3 +281,15 @@ TEST(ostream_test, range) { auto strs = std::vector{test_string("foo"), test_string("bar")}; EXPECT_EQ("[foo, bar]", fmt::format("{}", strs)); } + +struct abstract { + virtual ~abstract() = default; + virtual void f() = 0; + friend std::ostream& operator<<(std::ostream& os, const abstract&) { + return os; + } +}; + +void format_abstract_compiles(const abstract& a) { + fmt::format(FMT_COMPILE("{}"), a); +}