You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to use <format> using clang-target-msvc VS 2019, I got these 4 errors :
C:\Users\User\AppData\Roaming\fmt-master\include\format(611,26): error: no viable conversion from 'const char *' to
'std::basic_format_parse_context<char>::const_iterator' (aka '_String_view_iterator<std::char_traits<char> >')
parse_ctx.advance_to(p);
^
C:\Users\User\AppData\Roaming\fmt-master\include/fmt/format.h(2152,15): note: in instantiation of member function
'std::detail::format_handler<std::detail::arg_formatter<fmt::v5::back_insert_range<fmt::v5::internal::buffer<char> > >, char,
std::basic_format_context<std::back_insert_iterator<fmt::v5::internal::buffer<char> >, char> >::on_replacement_field' requested here
handler.on_replacement_field(p);
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\xstring(851,7): note: candidate constructor
(the implicit copy constructor) not viable: no known conversion from 'const char *' to 'const std::_String_view_iterator<std::char_traits<char> > &' for 1st
argument
class _String_view_iterator { // iterator for character buffer wrapper
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\xstring(851,7): note: candidate constructor
(the implicit move constructor) not viable: no known conversion from 'const char *' to 'std::_String_view_iterator<std::char_traits<char> > &&' for 1st argument
C:\Users\User\AppData\Roaming\fmt-master\include\format(153,46): note: passing argument to parameter 'it' here
constexpr void advance_to(const_iterator it);
^
C:\Users\User\AppData\Roaming\fmt-master\include\format(618,26): error: no viable conversion from 'const char *' to
'std::basic_format_parse_context<char>::const_iterator' (aka '_String_view_iterator<std::char_traits<char> >')
parse_ctx.advance_to(begin);
^~~~~
C:\Users\User\AppData\Roaming\fmt-master\include/fmt/format.h(2161,21): note: in instantiation of member function
'std::detail::format_handler<std::detail::arg_formatter<fmt::v5::back_insert_range<fmt::v5::internal::buffer<char> > >, char,
std::basic_format_context<std::back_insert_iterator<fmt::v5::internal::buffer<char> >, char> >::on_format_specs' requested here
p = handler.on_format_specs(p + 1, end);
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\xstring(851,7): note: candidate constructor
(the implicit copy constructor) not viable: no known conversion from 'const char *' to 'const std::_String_view_iterator<std::char_traits<char> > &' for 1st
argument
class _String_view_iterator { // iterator for character buffer wrapper
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\xstring(851,7): note: candidate constructor
(the implicit move constructor) not viable: no known conversion from 'const char *' to 'std::_String_view_iterator<std::char_traits<char> > &&' for 1st argument
C:\Users\User\AppData\Roaming\fmt-master\include\format(153,46): note: passing argument to parameter 'it' here
constexpr void advance_to(const_iterator it);
^
C:\Users\User\AppData\Roaming\fmt-master\include\format(620,42): error: no viable conversion from returned value of type
'std::basic_format_parse_context<char>::const_iterator' (aka '_String_view_iterator<std::char_traits<char> >') to function return type 'const char *'
if (visit_format_arg(f, arg)) return parse_ctx.begin();
^~~~~~~~~~~~~~~~~
C:\Users\User\AppData\Roaming\fmt-master\include\format(628,26): error: no viable conversion from 'const char *' to
'std::basic_format_parse_context<char>::const_iterator' (aka '_String_view_iterator<std::char_traits<char> >')
parse_ctx.advance_to(begin);
^~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\xstring(851,7): note: candidate constructor
(the implicit copy constructor) not viable: no known conversion from 'const char *' to 'const std::_String_view_iterator<std::char_traits<char> > &' for 1st
argument
class _String_view_iterator { // iterator for character buffer wrapper
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\xstring(851,7): note: candidate constructor
(the implicit move constructor) not viable: no known conversion from 'const char *' to 'std::_String_view_iterator<std::char_traits<char> > &&' for 1st argument
C:\Users\User\AppData\Roaming\fmt-master\include\format(153,46): note: passing argument to parameter 'it' here
constexpr void advance_to(const_iterator it);
^
4 errors generated.
Peeking into <format>, we are trying to convert plain char pointer to std::basic_string_view<charT>::const_iterator
template<class charT>
class basic_format_parse_context {
public:
using char_type = charT;
using const_iterator = typename basic_string_view<charT>::const_iterator;
using iterator = const_iterator;
In MSVC implementation, this basic_string_view<charT>::const_iterator is deliberately defined as _String_view_iterator<std::char_traits<char> > and this MSVC class template has one and only explicit private constructor from const std::char_traits<char>::chartype * which deliberately prohibits both implicit and explicit casting from const char * by outside users.
Does this mean in <format>, we must and always speak about string_view's iterators in term of basic_string_view<charT>::const_iterator when passing parameters?!?!
Does the standard have any plan to address these different approaches?
The text was updated successfully, but these errors were encountered:
When I try to use
<format>
using clang-target-msvc VS 2019, I got these 4 errors :Peeking into
<format>
, we are trying to convert plainchar
pointer tostd::basic_string_view<charT>::const_iterator
In MSVC implementation, this
basic_string_view<charT>::const_iterator
is deliberately defined as_String_view_iterator<std::char_traits<char> >
and this MSVC class template has one and only explicit private constructor fromconst std::char_traits<char>::chartype *
which deliberately prohibits both implicit and explicit casting fromconst char *
by outside users.Does this mean in
<format>
, we must and always speak about string_view's iterators in term ofbasic_string_view<charT>::const_iterator
when passing parameters?!?!Does the standard have any plan to address these different approaches?
The text was updated successfully, but these errors were encountered: