diff --git a/include/fmt/base.h b/include/fmt/base.h index 3bd16fcf..f91c435f 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -2148,7 +2148,9 @@ auto get_iterator(buffer&, OutputIt out) -> OutputIt { } // This type is intentionally undefined, only used for errors. -template struct type_is_unformattable_for; +template struct type_is_unformattable_for { + // Intentionally incomplete - causes compile error when instantiated +}; template struct string_value { const Char* data; @@ -2311,7 +2313,8 @@ template class value { FMT_CONSTEXPR value(const T&, custom_tag) { // Cannot format an argument; to make type T formattable provide a // formatter specialization: https://fmt.dev/latest/api#udt. - type_is_unformattable_for _; + static_assert(sizeof(T) != sizeof(T), + "Type is not formattable. Provide a formatter specialization."); } // Formats an argument of a custom type, such as a user-defined class.