-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix: Resolve IntelliSense/linter false positive for type_is_unformattable_for #4634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2148,7 +2148,9 @@ auto get_iterator(buffer<T>&, OutputIt out) -> OutputIt { | |
| } | ||
|
|
||
| // This type is intentionally undefined, only used for errors. | ||
| template <typename T, typename Char> struct type_is_unformattable_for; | ||
| template <typename T, typename Char> struct type_is_unformattable_for { | ||
| // Intentionally incomplete - causes compile error when instantiated | ||
| }; | ||
|
|
||
| template <typename Char> struct string_value { | ||
| const Char* data; | ||
|
|
@@ -2311,7 +2313,8 @@ template <typename Context> class value { | |
| FMT_CONSTEXPR value(const T&, custom_tag) { | ||
| // Cannot format an argument; to make type T formattable provide a | ||
| // formatter<T> specialization: https://fmt.dev/latest/api#udt. | ||
| type_is_unformattable_for<T, char_type> _; | ||
| static_assert(sizeof(T) != sizeof(T), | ||
| "Type is not formattable. Provide a formatter<T> specialization."); | ||
|
Comment on lines
+2316
to
+2317
|
||
| } | ||
|
|
||
| // Formats an argument of a custom type, such as a user-defined class. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment and struct implementation are contradictory. The comment on line 2150 says "This type is intentionally undefined" but the struct is now fully defined with an empty body. The comment on line 2152 says "Intentionally incomplete" but an empty struct is actually a complete type in C++.
Consider updating the comments to accurately reflect the new implementation. For example: