diff --git a/include/fmt/format.h b/include/fmt/format.h index 53094c1a50d9..6d5c1f6928fe 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3833,21 +3833,16 @@ FMT_CONSTEXPR void advance_to( auto s = fmt::format("{}", fmt::ptr(p)); \endrst */ -template inline const void* ptr(const T* p) { return p; } -template inline const void* ptr(const std::unique_ptr& p) { - return p.get(); +template const void* ptr(T p) { + static_assert(std::is_pointer::value, ""); + return detail::bit_cast(p); } -template inline const void* ptr(const std::shared_ptr& p) { +template const void* ptr(const std::unique_ptr& p) { return p.get(); } -#if !FMT_MSC_VER -// MSVC lets function pointers decay to void pointers, so this -// overload is unnecessary. -template -inline const void* ptr(T (*fn)(Args...)) { - return detail::bit_cast(fn); +template const void* ptr(const std::shared_ptr& p) { + return p.get(); } -#endif class bytes { private: