Created on 2026-02-12.00:00:00 last changed 1 week ago
Proposed resolution:
This wording is relative to N5032.
Modify [format.string.std] as indicated:
[Drafting note: [format.string.escaped] paragraph 2 similarly references the wide literal encoding (as the associated character encoding for `charT = wchar_t`. ]
-20- The meaning of some non-string presentation types is defined in terms of a call to `to_chars`. In such cases, let `[first, last)` be a range large enough to hold the `to_chars` output and value be the formatting argument value. Formatting is done as if by calling `to_chars` as specified , transcoding the `to_chars` output to the wide literal encoding if `charT` is `wchar_t`, and copying the output through the output iterator of the format context.
[Note 7: Additional padding and adjustments are performed prior to copying the output through the output iterator as specified by the format specifiers. — end note]
[ 2026-02-27; Reflector poll. ]
Set status to Tentatively Ready after eight votes in favour during reflector poll.
P3876 would address that, but we need to clarify the wording for existing standards.
The current wording in [format.string.std] paragraph 20 suggests that the expression `format(L"{}", 0)` could produce a garbage or malformed string:
[…] Formatting is done as if by calling `to_chars` as specified and copying the output through the output iterator of the format context.
It is not stated that transcoding takes place, so a plausible interpretation is that the output of `to_chars` is copied to the output iterator directly. If the ordinary literal encoding is, say, EBCDIC and the wide literal encoding is, say, UTF-32, simply converting `char` to `wchar_t` is not meaningful.
During the 2026-02-11 SG16 Telecon, when reviewing P3876R0, SG16 examined this issue and concluded that transcoding is intended here, affirmed by the author of P0645R10 Text Formatting. An LWG issue was requested.| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-02-27 16:05:19 | admin | set | messages: + msg15978 |
| 2026-02-27 16:05:19 | admin | set | status: new -> ready |
| 2026-02-14 14:36:26 | admin | set | messages: + msg15930 |
| 2026-02-12 00:00:00 | admin | create | |