Hi all,
I think this is the correct solution. Hopefully we can discuss the LWG issue in the next SG16 meeting.
Best regards,
Peter
From: SG16 <sg16-bounces@lists.isocpp.org>
On Behalf Of Victor Zverovich via SG16
Sent: 07 June 2023 19:09
To: Mark de Wever <koraq@xs4all.nl>
Cc: Victor Zverovich <victor.zverovich@gmail.com>; Tom Honermann via Lib-Ext <lib-ext@lists.isocpp.org>; Tom Honermann <tom@honermann.net>; SG16 <sg16@lists.isocpp.org>; Barry Revzin <barry.revzin@gmail.com>
Subject: Re: [SG16] [isocpp-lib-ext] Formatters converting sequences of char to sequences of wchar_t
EXTERNAL MAIL
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@xs4all.nl> 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