@@ -575,7 +575,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
&& _M_rep[__n - 1]._M_id == _M_id) [[likely]]
_M_rep += __n;
else
- *this == _Iterator{};
+ *this = _Iterator{};
}
else if (__n < 0)
{
@@ -583,7 +583,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
&& _M_rep[__n]._M_id == _M_id) [[likely]]
_M_rep += __n;
else
- *this == _Iterator{};
+ *this = _Iterator{};
}
}
if (__n != 0)
@@ -645,7 +645,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
private:
- friend class text_encoding;
+ friend struct text_encoding;
constexpr explicit
_Iterator(const _Rep* __r) noexcept
@@ -70,10 +70,25 @@ test_every_id()
auto end = aliases.end();
VERIFY( (begin + std::ranges::distance(aliases)) == end );
#ifndef _GLIBCXX_ASSERTIONS
- // This is an error, but with assertions disabled is guaranteed safe:
+ // These ops violate preconditions, but as libstdc++ extensions they are
+ // guaranteed to either assert or have well-defined behaviour.
+
+ // This erroneously returns ""sv:
VERIFY( begin[std::ranges::distance(aliases)] == ""sv );
// Likewise:
- VERIFY( begin[999999] == *begin );
+ VERIFY( begin[999999] == ""sv );
+
+ auto iter = begin;
+ std::ranges::advance(iter, end);
+ // Erroneously sets iter to a value-initialized state.
+ ++iter;
+ VERIFY( iter == decltype(iter){} );
+ VERIFY( *iter == ""sv );
+
+ iter = begin;
+ // Erroneously sets iter to a value-initialized state.
+ --iter;
+ VERIFY( iter == decltype(iter){} );
#endif
}
}