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.
_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;
--- /dev/null
+// { dg-do run { target c++11 } }
+// { dg-require-debug-mode "" }
+
+#include <vector>
+#include <algorithm>
+
+#include <testsuite_hooks.h>
+
+int main()
+{
+ std::vector<int>::iterator it{};
+ auto cpy = it;
+ std::advance(it, 0);
+ VERIFY( it == cpy );
+ return 0;
+}