diff --git a/include/fmt/core.h b/include/fmt/core.h index d5ae6beef2e9..d7d2de50126f 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -96,12 +96,6 @@ # define FMT_CONSTEXPR_DECL #endif -#if __cplusplus >= 202002L -# define FMT_CONSTEXPR20 constexpr -#else -# define FMT_CONSTEXPR20 inline -#endif - #ifndef FMT_OVERRIDE # if FMT_HAS_FEATURE(cxx_override_control) || \ (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1900 @@ -289,14 +283,6 @@ struct monostate {}; namespace detail { -constexpr bool is_constant_evaluated() FMT_DETECTED_NOEXCEPT { -#ifdef __cpp_lib_is_constant_evaluated - return std::is_constant_evaluated(); -#else - return false; -#endif -} - // A helper function to suppress "conditional expression is constant" warnings. template constexpr T const_check(T value) { return value; } diff --git a/include/fmt/format.h b/include/fmt/format.h index 04af5063038f..afcb32f5cf3e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -281,6 +281,20 @@ FMT_END_NAMESPACE FMT_BEGIN_NAMESPACE namespace detail { +#if __cplusplus >= 202002L +# define FMT_CONSTEXPR20 constexpr +#else +# define FMT_CONSTEXPR20 inline +#endif + +constexpr bool is_constant_evaluated() FMT_DETECTED_NOEXCEPT { +#ifdef __cpp_lib_is_constant_evaluated + return std::is_constant_evaluated(); +#else + return false; +#endif +} + // An equivalent of `*reinterpret_cast(&source)` that doesn't have // undefined behavior (e.g. due to type aliasing). // Example: uint64_t d = bit_cast(2.718);