From b723c021dfd521ca528925ae20472bac81089faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Schl=C3=BCter?= Date: Wed, 21 May 2025 04:21:06 +0900 Subject: [PATCH] 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. --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index c559b45f..5aac87e4 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3824,7 +3824,7 @@ struct formatter>> * auto s = fmt::format("{}", fmt::ptr(p)); */ template auto ptr(T p) -> const void* { - static_assert(std::is_pointer::value, ""); + static_assert(std::is_pointer::value, "fmt::ptr used with non-pointer"); return detail::bit_cast(p); }