C++ Logo

sg16

Advanced search

Re: [isocpp-lib-ext] Formatters converting sequences of char to sequences of wchar_t

From: Victor Zverovich <victor.zverovich_at_[hidden]>
Date: Wed, 7 Jun 2023 11:09:21 -0700
OK, I finally found time to look into this in detail and now convinced that
the correct solution is to update
http://eel.is/c++draft/format#formatter.spec disabling all formatters
listed there that may mix code unit types except for formatter<char,
wchar_t>. Previously they were disabled implicitly but C++23 inadvertently
enabled them. For example, we should disable

  template<class traits, class Allocator>
    struct formatter<basic_string<charT, traits, Allocator>, Char>;

when Char is different from charT.

Cheers,
Victor

On Thu, Jun 1, 2023 at 11:52 AM Mark de Wever <koraq_at_[hidden]> wrote:

> On Thu, Jun 01, 2023 at 12:20:59PM -0400, Tom Honermann via Lib-Ext wrote:
> > On 5/31/23 1:29 PM, Victor Zverovich via Lib-Ext wrote:
> > > Thanks for catching this, it looks like a serious problem.
> > >
> > > - Do we want to allow string types of chars to be formatted as
> > > sequences of wchar_ts?
> > >
> > > Definitely not. In general this requires transcoding and goes against
> > > the design of std::format.
> > >
> > > - Do we want to allow non string type sequences of chars to be
> > > formatted as sequences of wchar_ts?
> > >
> > > Similarly no.
> > >
> > > - Should we disable char to wchar_t conversion in the range_formatter?
> > >
> > > Probably yes but I haven't looked in detail yet.
> > My intuition matches Victor's for all three questions.
> > >
> > > Please open an LWG issue and we'll need to discuss it in SG16.
> >
> > Please copy me on the LWG issue request and I'll schedule it for
> discussion
> > in SG16 once it has been created.
>
> Victor, Tom, thanks for the input. I just filed an LWG issue.
>
> Cheers,
> Mark
>

Received on 2023-06-07 18:09:34