mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-29 18:27:40 +02:00
Give useful error when misusing fmt::ptr. (#4453)
static_assert(bla, "") prints an empty message but not the condition with at least MSVC. Add an informative message.
This commit is contained in:
@ -3824,7 +3824,7 @@ struct formatter<T, Char, void_t<detail::format_as_result<T>>>
|
|||||||
* auto s = fmt::format("{}", fmt::ptr(p));
|
* auto s = fmt::format("{}", fmt::ptr(p));
|
||||||
*/
|
*/
|
||||||
template <typename T> auto ptr(T p) -> const void* {
|
template <typename T> auto ptr(T p) -> const void* {
|
||||||
static_assert(std::is_pointer<T>::value, "");
|
static_assert(std::is_pointer<T>::value, "fmt::ptr used with non-pointer");
|
||||||
return detail::bit_cast<const void*>(p);
|
return detail::bit_cast<const void*>(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user