-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix format
a long
value with formatter
#2768
Conversation
Co-authored-by: S. B. Tam <cpplearner@outlook.com>
format
a long
value with formatter
format
a long
value with custom formatter
format
a long
value with custom formatter
format
a long
value with formatter
This comment was marked as resolved.
This comment was marked as resolved.
This seems to be because Lines 1778 to 1780 in 17fde2c
Maybe the constrained overload is considered to be more specialized? Lines 1744 to 1745 in 17fde2c
|
Thanks for fixing this bug! I pushed minor stylistic changes and a small test coverage increase - please meow if you disagree. |
Co-authored-by: S. B. Tam <cpplearner@outlook.com>
Thanks @cpplearner for noticing that
I verified that adding test coverage for |
No,
and inside STL/tests/std/tests/P0355R7_calendars_and_time_zones_formatting/test.cpp Lines 817 to 826 in 17fde2c
All STL/tests/std/tests/P0355R7_calendars_and_time_zones_formatting/test.cpp Lines 234 to 239 in 17fde2c
So |
That #include <format>
#include <string>
using namespace std;
using A = _Format_arg_traits<format_context>::_Storage_type<string>;
using B = _Format_arg_traits<format_context>::_Storage_type<const string>;
static_assert(is_same_v<A, basic_format_arg<format_context>::handle>);
static_assert(is_same_v<B, string_view>); |
well done @cpplearner ! template <class _Traits, class _Alloc>
static auto _Phony_basic_format_arg_constructor(const basic_string<_Char_type, _Traits, _Alloc>&)
-> basic_string_view<_Char_type>; // not defined to template <class _Traits, class _Alloc>
static auto _Phony_basic_format_arg_constructor(basic_string<_Char_type, _Traits, _Alloc>)
-> basic_string_view<_Char_type>; // not defined ? |
Co-authored-by: S. B. Tam <cpplearner@outlook.com>
…e previous version fix
Yes, I did it intentionally because we don't modify |
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.
Approved, despite this not doing what the standard says for basic_string&
Agree with Casey that we need to reformulate how this overload set works, it's been a very consistent source of bugs in both our implementation and the standard.
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for the bugfix and targeted overhaul here, improving our implementation beyond the Standard itself! 😹 🐞 🎉 |
Co-authored-by: S. B. Tam <cpplearner@outlook.com> Co-authored-by: Stephan T. Lavavej <stl@microsoft.com>
Fixes #2765
Although @cpplearner wrote everything in the issue, I was able to write
correctly only the third time :)