https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127540
--- Comment #1 from Antti Nietosvaara <antti at nietosvaara dot fi> ---
I did try switching the order of self test and verification in the move
assignment operator, and it seems to get rid of this error, but I'm not sure if
it breaks some other test case.
Tested by copying the headers to gcc-headers folder for modifications and
compiling with g++ -nostdinc++ -Igcc-headers -Igcc-headers/x86_64-redhat-linux
--- /usr/include/c++/14/debug/safe_iterator.h 2026-02-26 02:00:00.000000000
+0200
+++ gcc-headers/debug/safe_iterator.h 2026-09-21 14:10:12.710639839 +0300
@@ -310,15 +310,15 @@
return *this;
}
+ if (std::__addressof(__x) == this)
+ return *this;
+
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
|| __x._M_value_initialized(),
_M_message(__msg_copy_singular)
._M_iterator(*this, "this")
._M_iterator(__x, "other"));
- if (std::__addressof(__x) == this)
- return *this;
-
if (this->_M_sequence && this->_M_sequence == __x._M_sequence)
_GLIBCXX20_CONSTEXPR_NON_LITERAL_SCOPE_BEGIN {
__gnu_cxx::__scoped_lock __l(this->_M_get_mutex());