aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-05-16 17:15:55 +0100
committerJonathan Wakely <jwakely@redhat.com>2024-05-17 13:46:48 +0100
commitc9e05b03c18e898be604ab90401476e9c473cc52 (patch)
tree07519ce700ce597b4399eedc0223a7fb81d3a612 /libstdc++-v3
parent4b9e68a6f3b22800a7f12b58ef6b25e3b339bb3c (diff)
downloadgcc-c9e05b03c18e898be604ab90401476e9c473cc52.zip
gcc-c9e05b03c18e898be604ab90401476e9c473cc52.tar.gz
gcc-c9e05b03c18e898be604ab90401476e9c473cc52.tar.bz2
libstdc++: Fix typo in _Grapheme_cluster_view::_Iterator [PR115119]
libstdc++-v3/ChangeLog: PR libstdc++/115119 * include/bits/unicode.h (_Iterator::operator++(int)): Fix typo in increment expression. * testsuite/ext/unicode/grapheme_view.cc: Check post-increment on view's iterator.
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/include/bits/unicode.h6
-rw-r--r--libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc11
2 files changed, 15 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/unicode.h b/libstdc++-v3/include/bits/unicode.h
index 4623814..a14a17c 100644
--- a/libstdc++-v3/include/bits/unicode.h
+++ b/libstdc++-v3/include/bits/unicode.h
@@ -34,10 +34,12 @@
#include <array>
#include <bit> // bit_width
#include <charconv> // __detail::__from_chars_alnum_to_val_table
+#include <string_view>
#include <cstdint>
#include <bits/stl_algo.h>
#include <bits/stl_iterator.h>
-#include <bits/ranges_base.h>
+#include <bits/ranges_base.h> // iterator_t, sentinel_t, input_range, etc.
+#include <bits/ranges_util.h> // view_interface
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -802,7 +804,7 @@ inline namespace __v15_1_0
operator++(int)
{
auto __tmp = *this;
- ++this;
+ ++*this;
return __tmp;
}
diff --git a/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc b/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc
index ac1e8c5..a3bb36e 100644
--- a/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc
+++ b/libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc
@@ -83,10 +83,21 @@ test_breaks()
VERIFY( iter == gv.end() );
}
+constexpr void
+test_pr115119()
+{
+ // PR 115119 Typo in _Grapheme_cluster_view::_Iterator::operator++(int)
+ uc::_Grapheme_cluster_view gv(" "sv);
+ auto it = std::ranges::begin(gv);
+ it++;
+ VERIFY( it == std::ranges::end(gv) );
+}
+
int main()
{
auto run_tests = []{
test_breaks();
+ test_pr115119();
return true;
};