diff --git a/include/fmt/color.h b/include/fmt/color.h index afdf721c..49407e3c 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -298,11 +298,9 @@ class text_style { } } - friend FMT_CONSTEXPR_DECL text_style - fg(detail::color_type foreground) noexcept; + friend FMT_CONSTEXPR text_style fg(detail::color_type foreground) noexcept; - friend FMT_CONSTEXPR_DECL text_style - bg(detail::color_type background) noexcept; + friend FMT_CONSTEXPR text_style bg(detail::color_type background) noexcept; detail::color_type foreground_color; detail::color_type background_color; diff --git a/include/fmt/core.h b/include/fmt/core.h index 31d63d6b..ac829cfa 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -102,10 +102,8 @@ #endif #if FMT_USE_CONSTEXPR # define FMT_CONSTEXPR constexpr -# define FMT_CONSTEXPR_DECL constexpr #else # define FMT_CONSTEXPR -# define FMT_CONSTEXPR_DECL #endif #if ((__cplusplus >= 202002L) && \ @@ -116,7 +114,7 @@ # define FMT_CONSTEXPR20 #endif -// Check if constexpr std::char_traits<>::compare,length is supported. +// Check if constexpr std::char_traits<>::{compare,length} are supported. #if defined(__GLIBCXX__) # if __cplusplus >= 201703L && defined(_GLIBCXX_RELEASE) && \ _GLIBCXX_RELEASE >= 7 // GCC 7+ libstdc++ has _GLIBCXX_RELEASE. @@ -253,7 +251,7 @@ #ifndef FMT_CONSTEVAL # if ((FMT_GCC_VERSION >= 1000 || FMT_CLANG_VERSION >= 1101) && \ - __cplusplus > 201703L && !defined(__apple_build_version__)) || \ + __cplusplus >= 202002L && !defined(__apple_build_version__)) || \ (defined(__cpp_consteval) && \ (!FMT_MSC_VERSION || _MSC_FULL_VER >= 193030704)) // consteval is broken in MSVC before VS2022 and Apple clang 13. diff --git a/include/fmt/format.h b/include/fmt/format.h index 9434efab..9d037cfe 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2710,7 +2710,7 @@ class bigint { return bigits_[to_unsigned(index)]; } - static FMT_CONSTEXPR_DECL const int bigit_bits = num_bits(); + static constexpr const int bigit_bits = num_bits(); friend struct formatter; diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index 62a3cdc1..a1fc80d2 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -55,7 +55,7 @@ template class is_std_string_like { template static void check(...); public: - static FMT_CONSTEXPR_DECL const bool value = + static constexpr const bool value = is_string::value || std::is_convertible>::value || !std::is_void(nullptr))>::value; @@ -70,9 +70,9 @@ template class is_map { public: #ifdef FMT_FORMAT_MAP_AS_LIST - static FMT_CONSTEXPR_DECL const bool value = false; + static constexpr const bool value = false; #else - static FMT_CONSTEXPR_DECL const bool value = + static constexpr const bool value = !std::is_void(nullptr))>::value; #endif }; @@ -83,9 +83,9 @@ template class is_set { public: #ifdef FMT_FORMAT_SET_AS_LIST - static FMT_CONSTEXPR_DECL const bool value = false; + static constexpr const bool value = false; #else - static FMT_CONSTEXPR_DECL const bool value = + static constexpr const bool value = !std::is_void(nullptr))>::value && !is_map::value; #endif }; @@ -174,7 +174,7 @@ template class is_tuple_like_ { template static void check(...); public: - static FMT_CONSTEXPR_DECL const bool value = + static constexpr const bool value = !std::is_void(nullptr))>::value; }; @@ -279,7 +279,7 @@ OutputIt write_range_entry(OutputIt out, const Arg& v) { } // namespace detail template struct is_tuple_like { - static FMT_CONSTEXPR_DECL const bool value = + static constexpr const bool value = detail::is_tuple_like_::value && !detail::is_range_::value; }; @@ -315,7 +315,7 @@ struct formatter::value>> { }; template struct is_range { - static FMT_CONSTEXPR_DECL const bool value = + static constexpr const bool value = detail::is_range_::value && !detail::is_std_string_like::value && !detail::is_map::value && !std::is_convertible>::value && diff --git a/test/format-test.cc b/test/format-test.cc index 542761b6..8e44be13 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1829,8 +1829,8 @@ fmt::string_view to_string_view(string_like) { return "foo"; } constexpr char with_null[3] = {'{', '}', '\0'}; constexpr char no_null[2] = {'{', '}'}; -static FMT_CONSTEXPR_DECL const char static_with_null[3] = {'{', '}', '\0'}; -static FMT_CONSTEXPR_DECL const char static_no_null[2] = {'{', '}'}; +static constexpr const char static_with_null[3] = {'{', '}', '\0'}; +static constexpr const char static_no_null[2] = {'{', '}'}; TEST(format_test, compile_time_string) { EXPECT_EQ("foo", fmt::format(FMT_STRING("foo")));