diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-05-18 10:21:27 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-05-18 10:21:27 -0400 |
commit | 38751c4d5e15bd1c682ac4c868a2c4ce48ca5503 (patch) | |
tree | ff029950b27ac33561b143c489fe2c1a73ea127f /libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc | |
parent | 8b9484c54b4000209d4bfb270e22c9c8b9673fdb (diff) | |
download | gcc-38751c4d5e15bd1c682ac4c868a2c4ce48ca5503.tar.gz |
libstdc++: Fix access issue in elements_view::_Sentinel [PR100631]
In the earlier commit r12-854 I forgot to also rewrite the other operator-
overload in terms of the split-out member function _M_distance_from.
libstdc++-v3/ChangeLog:
PR libstdc++/100631
* include/std/ranges (elements_view::_Sentinel::operator-): Use
_M_distance_from in the other operator- overload too.
* testsuite/std/ranges/adaptors/elements.cc (test06): Augment test.
Diffstat (limited to 'libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc')
-rw-r--r-- | libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc index c6839e38ce5..1322f44036e 100644 --- a/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc +++ b/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc @@ -128,7 +128,8 @@ test06() | views::keys; auto b = r.begin(); auto e = r.end(); - e - b; + VERIFY( e - b == 42 ); + VERIFY( b - e == -42 ); } void |