diff --git a/include/fmt/core.h b/include/fmt/core.h index b362b235..3097feee 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1222,6 +1222,8 @@ using long_type = conditional_t; using ulong_type = conditional_t; // Maps formatting arguments to core types. +// arg_mapper reports errors by returning unformattable instead of using +// static_assert because it's used in the is_formattable trait. template struct arg_mapper { using char_type = typename Context::char_type; @@ -1325,10 +1327,6 @@ template struct arg_mapper { template FMT_CONSTEXPR auto map(T) -> enable_if_t::value, unformattable_pointer> { - // Formatting of arbitrary pointers is disallowed. If you want to output - // a pointer cast it to "void *" or "const void *". In particular, this - // forbids formatting of "[const] volatile char *" which is printed as bool - // by iostreams. return {}; } @@ -1593,10 +1591,14 @@ template FMT_CONSTEXPR FMT_INLINE auto make_arg(T&& val) -> value { const auto& arg = arg_mapper().map(std::forward(val)); + + // Formatting of arbitrary pointers is disallowed. If you want to output + // a pointer cast it to "void *" or "const void *". In particular, this + // forbids formatting of "[const] volatile char *" which is printed as bool + // by iostreams. constexpr bool void_ptr = !std::is_same::value; - static_assert(void_ptr, - "Formatting of non-void pointers is disallowed."); + static_assert(void_ptr, "Formatting of non-void pointers is disallowed."); constexpr bool formattable = !std::is_same::value; static_assert(