From 7fbeceed8f5298cb886eca8f79b117a7f7329c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Schl=C3=BCter?= Date: Tue, 20 May 2025 23:00:47 +0900 Subject: [PATCH] Give useful error when misusing fmt::ptr. 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); }