fix format a long value with formatter#2768
Conversation
Co-authored-by: S. B. Tam <[email protected]>
format a long value with formatterformat a long value with custom formatter
format a long value with custom formatterformat 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 <[email protected]>
|
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 <[email protected]>
…e previous version fix
|
Yes, I did it intentionally because we don't modify |
barcharcraz
left a comment
There was a problem hiding this comment.
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 <[email protected]> Co-authored-by: Stephan T. Lavavej <[email protected]>
Fixes #2765
Although @cpplearner wrote everything in the issue, I was able to write
correctly only the third time :)