aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2020-05-27 21:58:56 +0100
committerJonathan Wakely <jwakely@redhat.com>2020-05-27 21:58:56 +0100
commit979e89a9a94f66241fa8355e2b2e8f4a680c83e1 (patch)
tree4b5847f39a85c3f6ee3d1b8dd3c9f718b99301a2 /gcc/builtins.c
parent1852a26b925970f64f8d31518ba732fe9c3ade23 (diff)
downloadgcc-979e89a9a94f66241fa8355e2b2e8f4a680c83e1.zip
gcc-979e89a9a94f66241fa8355e2b2e8f4a680c83e1.tar.gz
gcc-979e89a9a94f66241fa8355e2b2e8f4a680c83e1.tar.bz2
libstdc++: Fix std::reverse_iterator comparisons (PR 94354)
The std::reverse_iterator comparisons have always been implemented only in terms of equality and less than. In C++98 that made no difference for reasonable code, because when the underlying operators are the same type they are required to support all comparisons anyway. But since LWG 280 it's possible to compare reverse_iterator<X> and reverse_iterator<Y>, and comparisons between X and Y might not support the full set of equality and relational operators. This means that it matters whether we implement operator!= as x.base() != y.base() or !(x.base() == y.base()), and the current implementation is non-conforming. This was already fixed in GCC 10.1 for C++20, this change also fixes it for all other -std modes. PR libstdc++/94354 * include/bits/stl_iterator.h (reverse_iterator): Fix comparison operators to use the correct operations on the underlying iterators. * testsuite/24_iterators/reverse_iterator/rel_ops.cc: New test.
Diffstat (limited to 'gcc/builtins.c')
0 files changed, 0 insertions, 0 deletions