From 0438dd20f8cf25966f6f4538a1faaa3fd9e774fe Mon Sep 17 00:00:00 2001 From: Subash Chandra <120974338+subashc2023@users.noreply.github.com> Date: Sun, 21 Dec 2025 07:25:41 -0600 Subject: [PATCH] Fix: Resolve IntelliSense/linter false positive for type_is_unformattable_for - Make type_is_unformattable_for a complete struct definition - Replace variable declaration with static_assert for compile-time errors - Fixes false positive IDE errors while maintaining original behavior Fixes issue where IDEs like VS Code show red error indicators in file tree for projects using fmt, even though compilation succeeds. --- include/fmt/base.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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.