diff --git a/include/fmt/core.h b/include/fmt/core.h index dcfb5081..74f81458 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1529,26 +1529,28 @@ template struct type_is_unformattable_for; #endif template -FMT_CONSTEXPR FMT_INLINE auto make_arg(T& val) -> value { +FMT_CONSTEXPR auto make_arg(T& val) -> value { using arg_type = remove_cvref_t().map(val))>; - constexpr bool formattable_char = - !std::is_same::value; + // Use enum instead of constexpr because the latter may generate code. + enum { + formattable_char = !std::is_same::value + }; static_assert(formattable_char, "Mixing character types is disallowed."); // Formatting of arbitrary pointers is disallowed. If you want to format a // pointer cast it to `void*` or `const void*`. In particular, this forbids // formatting of `[const] volatile char*` printed as bool by iostreams. - constexpr bool formattable_pointer = - !std::is_same::value; + enum { + formattable_pointer = !std::is_same::value + }; static_assert(formattable_pointer, "Formatting of non-void pointers is disallowed."); - constexpr bool formattable = !std::is_same::value; + enum { formattable = !std::is_same::value }; #if defined(__cpp_if_constexpr) - if constexpr (!formattable) { + if constexpr (!formattable) type_is_unformattable_for _; - } #endif static_assert( formattable,