Date: Wed, 7 Jun 2023 20:27:02 +0200
On Wed, Jun 07, 2023 at 11:09:21AM -0700, Victor Zverovich via Lib-Ext wrote:
> 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.
This indeed matches my conclusion for the minimal fix.
Only making that change does not prevent
format(L"{}", vector{'H', 'i'}); // gives ['H', 'i']
since that uses
formatter<char, wchar_t>
You want to keep allowing this conversion?
Cheers,
Mark
> 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.
This indeed matches my conclusion for the minimal fix.
Only making that change does not prevent
format(L"{}", vector{'H', 'i'}); // gives ['H', 'i']
since that uses
formatter<char, wchar_t>
You want to keep allowing this conversion?
Cheers,
Mark
Received on 2023-06-07 18:27:07