Created on 2026-06-01.00:00:00 last changed 1 week ago
Proposed resolution:
This wording is relative to N5046.
Modify [locale.codecvt.virtuals] as indicated:
result do_out( stateT& state, const internT* from, const internT* from_end, const internT*& from_next, externT* to, externT* to_end, externT*& to_next) const; result do_in( stateT& state, const externT* from, const externT* from_end, const externT*& from_next, internT* to, internT* to_end, internT*& to_next) const;-1- Preconditions:
[…](from <= from_end && to <= to_end) is well-defined and `true``[from, from_end)` and `[to, to_end)` are both valid ranges; `state` is initialized, if at the beginning of a sequence, or else is equal to the result of converting the preceding characters in the sequence.result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;[…]-7- Preconditions:
[…](to <= to_end) is well-defined and `true``[to, to_end)` is a valid range; `state` is initialized, if at the beginning of a sequence, or else is equal to the result of converting the preceding characters in the sequence.int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;-12- Preconditions:
[…](from <= from_end) is well-defined and `true``[from, from_end)` is a valid range; `state` is initialized, if at the beginning of a sequence, or else is equal to the result of converting the preceding characters in the sequence.
Currently, some preconditions in [locale.codecvt.virtuals] require that "first <= last is well-defined and `true`", where first and last are pointer parameters that are intended to denote a range. These preconditions seem specified too relaxedly, and make some necessary preconditions implicitly specified in Effects. Per [expr.rel], comparing pointers that are not associated with the same storage instance still has well-defined behavior although the result is unspecified. And even if the result is specified to be true, it's possible for first and last to point to elements of different array subobjects in the same complete object, which renders last not reachable from first.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-06-13 12:17:39 | admin | set | messages: + msg16431 |
| 2026-06-01 00:00:00 | admin | create | |