__node_type* _M_cur;
- _Node_iterator_base() = default;
+ _Node_iterator_base() : _M_cur(nullptr) { }
_Node_iterator_base(__node_type* __p) noexcept
: _M_cur(__p) { }
using reference = typename std::conditional<__constant_iterators,
const value_type&, value_type&>::type;
- _Node_iterator() noexcept
- : __base_type(nullptr) { }
+ _Node_iterator() = default;
explicit
_Node_iterator(__node_type* __p) noexcept
typedef const value_type* pointer;
typedef const value_type& reference;
- _Node_const_iterator() noexcept
- : __base_type(nullptr) { }
+ _Node_const_iterator() = default;
explicit
_Node_const_iterator(__node_type* __p) noexcept
* valid iterator range within this sequence.
*/
#define __glibcxx_check_erase_range_after(_First,_Last) \
+_GLIBCXX_DEBUG_VERIFY(!_First._M_singular() && !_Last._M_singular(), \
+ _M_message(__gnu_debug::__msg_erase_different) \
+ ._M_sequence(*this, "this") \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last)); \
_GLIBCXX_DEBUG_VERIFY(_First._M_can_compare(_Last), \
_M_message(__gnu_debug::__msg_erase_different) \
._M_sequence(*this, "this") \
#endif
#define _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, _BadMsgId, _DiffMsgId) \
- _GLIBCXX_DEBUG_VERIFY(!_Lhs._M_singular() && !_Rhs._M_singular(), \
+ _GLIBCXX_DEBUG_VERIFY(!_Lhs._M_singular() && !_Rhs._M_singular() \
+ || (_Lhs.base() == _Iterator() \
+ && _Rhs.base() == _Iterator()), \
_M_message(_BadMsgId) \
._M_iterator(_Lhs, #_Lhs) \
._M_iterator(_Rhs, #_Rhs)); \
std::pair<difference_type, _Distance_precision>& __dist,
bool __check_dereferenceable) const
{
- if (!_M_can_compare(__rhs))
+ if (_M_singular() || __rhs._M_singular() || !_M_can_compare(__rhs))
return false;
/* Determine iterators order */
std::pair<difference_type,
_Distance_precision>& __dist) const
{
- if (!this->_M_can_compare(__rhs))
+ if (this->_M_singular() || __rhs._M_singular()
+ || !this->_M_can_compare(__rhs))
return false;
/* Determine iterators order */
#include <debug/safe_unordered_base.h>
#define _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs) \
- _GLIBCXX_DEBUG_VERIFY(!_Lhs._M_singular() && !_Rhs._M_singular(), \
+ _GLIBCXX_DEBUG_VERIFY(!_Lhs._M_singular() && !_Rhs._M_singular() \
+ || (_Lhs.base() == _Iterator{} \
+ && _Rhs.base() == _Iterator{}), \
_M_message(__msg_iter_compare_bad) \
._M_iterator(_Lhs, "lhs") \
._M_iterator(_Rhs, "rhs")); \
bool
_Safe_iterator_base::
_M_can_compare(const _Safe_iterator_base& __x) const throw ()
- {
- return (!_M_singular()
- && !__x._M_singular() && _M_sequence == __x._M_sequence);
- }
+ { return _M_sequence == __x._M_sequence; }
__gnu_cxx::__mutex&
_Safe_iterator_base::
--- /dev/null
+// Copyright (C) 2021 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do run { target c++11 } }
+
+#include <debug/deque>
+#include <testsuite_hooks.h>
+
+// PR libstdc++/98466
+
+void test01()
+{
+ __gnu_debug::deque<int>::iterator it{};
+ VERIFY( it == it );
+
+ __gnu_debug::deque<int>::const_iterator cit{};
+ VERIFY( cit == cit );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// Copyright (C) 2021 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do run { target c++11 } }
+
+#include <debug/unordered_map>
+#include <testsuite_hooks.h>
+
+// PR libstdc++/98466
+
+void test01()
+{
+ __gnu_debug::unordered_map<int, int>::iterator it{};
+ VERIFY( it == it );
+
+ __gnu_debug::unordered_map<int, int>::const_iterator cit{};
+ VERIFY( cit == cit );
+
+ __gnu_debug::unordered_map<int, int>::local_iterator lit{};
+ VERIFY( lit == lit );
+
+ __gnu_debug::unordered_map<int, int>::const_local_iterator clit{};
+ VERIFY( clit == clit );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}