diff options
| author | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-11-14 17:43:59 +0100 |
|---|---|---|
| committer | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-11-14 18:27:01 +0100 |
| commit | f94a73e0fcedf7a05b04aa12beee57b9a82859a5 (patch) | |
| tree | 651933e7a1b6794b7f2437930cba692cf1c5b5c4 /libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java | |
| parent | 14e5e4ee1ff4aa499eb036a950e1695351bc0e2e (diff) | |
libstdc++: Ensure that _Utf_view is always a view.
Previously, _Utf_view accepted any input_range, including reference-to-array
types like char(&)[2], and stored it as the _M_base member. In such cases,
_Utf_view was not assignable, failing the requirements of view concept.
This patch addresses the issue by adding the ranges::view constraint to the
second template parameter of _Utf_view, and for clarity renaming it from
_Range to _View. The constructor is also adjusted to accept its argument
by value (views must be O(1) move-constructible). This prevents implicitly
generated CTAD from deducing a reference type.
This makes _Utf_view consistent with both other standard views and the
wording from P2728R8: Unicode in the Library, Part 1: UTF Transcoding [1].
The explicit CTAD from viewable_range is not defined for _Utf_view because
it depends on views::all_t, views::ref_view, and views::owning_view,
which are declared in <ranges>. Consequently, users must explicitly cast
the argument to a view or specify it as a template parameter.
[1] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2728r8.html
libstdc++-v3/ChangeLog:
* include/bits/unicode.h (_Utf_view): Rename the template parameter
from _Range to _View and constrain it with ranges::view.
(_Utf_view::_Utf_view): Accept by value instead of rvalue reference.
* include/std/format (__format::__write_padded): Replace _Utf_view
over const char32_t(&)[1] with span<const char32_t, 1>.
* testsuite/ext/unicode/view.cc: Add checks if specialization
of _Utf_view satisfy view. Wrap arrays into std::span before
constructing _Utf_view.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Diffstat (limited to 'libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java')
0 files changed, 0 insertions, 0 deletions
