diff --git a/include/fmt/format.h b/include/fmt/format.h index ceef2ef1..f5835d9d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2112,8 +2112,14 @@ FMT_CONSTEXPR OutputIt write(OutputIt out, T value) { } template ::value && + !std::is_same::value && + !std::is_same::value)> +#else FMT_ENABLE_IF(std::is_enum::value && !std::is_same::value)> +#endif FMT_CONSTEXPR OutputIt write(OutputIt out, T value) { return write( out, static_cast::type>(value)); @@ -3562,7 +3568,7 @@ FMT_FORMAT_AS(Char*, const Char*); FMT_FORMAT_AS(std::basic_string, basic_string_view); FMT_FORMAT_AS(std::nullptr_t, const void*); FMT_FORMAT_AS(detail::std_string_view, basic_string_view); -#if __cplusplus >= 201703L +#ifdef __cpp_lib_byte FMT_FORMAT_AS(std::byte, unsigned); #endif diff --git a/test/format-test.cc b/test/format-test.cc index 81bc406f..e821e773 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1762,7 +1762,7 @@ TEST(FormatTest, JoinArg) { #endif } -#if __cplusplus >= 201703L +#ifdef __cpp_lib_byte TEST(FormatTest, JoinBytes) { std::vector v = {std::byte(1), std::byte(2), std::byte(3)}; EXPECT_EQ("1, 2, 3", fmt::format("{}", fmt::join(v, ", ")));