This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of SG16 status.

4090. Underspecified use of locale facets for locale-dependent std::format

Section: 28.5.2.2 [format.string.std] Status: SG16 Submitter: Jens Maurer Opened: 2024-04-30 Last modified: 2024-05-08

Priority: 3

View other active issues in [format.string.std].

View all other issues in [format.string.std].

View all issues with SG16 status.

Discussion:

There are std::format variants that take an explicit std::locale parameter. There is the "L" format specifier that uses that locale (or some environment locale) for formatting, according to 28.5.2.2 [format.string.std] p17:

"For integral types, the locale-specific form causes the context's locale to be used to insert the appropriate digit group separator characters."

It is unclear which specific facets are used to make this happen. This is important, because users can install their own facets into a given locale. Specific questions include:

Assuming the encoding for char is UTF-8, the use of a user-provided num_put<> facet (as opposed to std::format creating the output based on numpunct<>) would allow digit separators that are not expressibly as a single UTF-8 code unit.

[2024-05-08; Reflector poll]

Set priority to 3 after reflector poll.

Proposed resolution: