diff options
author | François Dumont <fdumont@gcc.gnu.org> | 2024-03-17 19:06:55 +0100 |
---|---|---|
committer | François Dumont <fdumont@gcc.gnu.org> | 2024-03-18 22:30:55 +0100 |
commit | dda96a9d942d73a587e174dd5efe061208a195af (patch) | |
tree | 7a95f9d2987b623c47237b4c1f5f2f2ab59be7d3 /libstdc++-v3/include | |
parent | 5f6e0853c30fec72d977afaa6f7a5633a8d910be (diff) | |
download | gcc-dda96a9d942d73a587e174dd5efe061208a195af.zip gcc-dda96a9d942d73a587e174dd5efe061208a195af.tar.gz gcc-dda96a9d942d73a587e174dd5efe061208a195af.tar.bz2 |
libstdc++: Fix N3344 behavior on _Safe_iterator::_M_can_advance
We shall be able to advance from a 0 offset a value-initialized iterator.
libstdc++-v3/ChangeLog:
* include/debug/safe_iterator.tcc (_Safe_iterator<>::_M_can_advance):
Accept 0 offset advance on value-initialized iterator.
* testsuite/23_containers/vector/debug/n3644.cc: New test case.
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/debug/safe_iterator.tcc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libstdc++-v3/include/debug/safe_iterator.tcc b/libstdc++-v3/include/debug/safe_iterator.tcc index 4b2baf2..deaa84d 100644 --- a/libstdc++-v3/include/debug/safe_iterator.tcc +++ b/libstdc++-v3/include/debug/safe_iterator.tcc @@ -86,6 +86,9 @@ namespace __gnu_debug _Safe_iterator<_Iterator, _Sequence, _Category>:: _M_can_advance(difference_type __n, bool __strict) const { + if (this->_M_value_initialized() && __n == 0) + return true; + if (this->_M_singular()) return false; |