]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Fix typo in _Grapheme_cluster_view::_Iterator [PR115119]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 16 May 2024 16:15:55 +0000 (17:15 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 17 May 2024 12:46:48 +0000 (13:46 +0100)
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.

libstdc++-v3/include/bits/unicode.h
libstdc++-v3/testsuite/ext/unicode/grapheme_view.cc

index 46238143fb61b2d49937e6ae1d539093911f95cc..a14a17c5dfcf547e10dc3db948d150ed56237f65 100644 (file)
 #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;
        }
 
index ac1e8c50b0596ec26ba8d834446a265cc3a74236..a3bb36e14b8ea118ac4ebffda9dfa5e114b79249 100644 (file)
@@ -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;
   };
 
This page took 0.066059 seconds and 5 git commands to generate.