From a770009fcc295b3a6f5b314e4eafaaadc5580444 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 13 Dec 2019 11:28:09 -0800 Subject: [PATCH] Improve error reporting --- include/fmt/core.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/fmt/core.h b/include/fmt/core.h index 9fd8df28..f4fe1088 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -930,6 +930,16 @@ template struct arg_mapper { std::memcpy(val.data, &arg, sizeof(arg)); return val; } + + int map(...) { + constexpr bool formattable = sizeof(Context) == 0; + static_assert( + formattable, + "Cannot format argument. To make type T formattable provide a " + "formatter specialization: " + "https://fmt.dev/latest/api.html#formatting-user-defined-types"); + return 0; + } }; // A type constant after applying arg_mapper.