aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu/java/util
diff options
context:
space:
mode:
authorTomasz Kamiński <tkaminsk@redhat.com>2025-04-16 13:39:04 +0200
committerTomasz Kamiński <tkaminsk@redhat.com>2025-04-16 14:32:57 +0200
commitaef87975224b0a4b5b103f241fd366b0e3a21360 (patch)
tree62e40c32b04285e548f944f40adf1f63f8ae2c2b /libjava/gnu/java/util
parentfa99720e9f3447565d274baaa81e23c2ddab4a67 (diff)
downloadgcc-aef87975224b0a4b5b103f241fd366b0e3a21360.zip
gcc-aef87975224b0a4b5b103f241fd366b0e3a21360.tar.gz
gcc-aef87975224b0a4b5b103f241fd366b0e3a21360.tar.bz2
libstdc++: Fix constification in range_formatter::format [PR109162]
The _Rg is deduced to lvalue reference for the lvalue arguments, and in such case __format::__maybe_const_range<_Rg, _CharT> is always _Rg (adding const to reference does not change behavior). Now we correctly check if _Range = remove_reference_t<_Rg> is const formattable range, furthermore as range_formatter<T> can only format ranges of values of type (possibly const) _Tp, we additional check if the remove_cvref_t<range_reference_t<const _Range>> is _Tp. The range_reference_t<R> and range_reference_t<const R> have different types (modulo remove_cvref_t) for std::vector<bool> (::reference and bool) or flat_map<T, U> (pair<const T&, U&> and pair<const T&, const U&>). PR libstdc++/109162 libstdc++-v3/ChangeLog: * include/std/format (range_formatter::format): Format const range, only if reference type is not changed. * testsuite/std/format/ranges/formatter.cc: New tests. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Diffstat (limited to 'libjava/gnu/java/util')
0 files changed, 0 insertions, 0 deletions