https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112477
Bug ID: 112477 Summary: Assignment of value-initialized iterators differs from value-initialization Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dangelog at gmail dot com Target Milestone: --- In debug mode there seems to be a difference between a value-initialized iterator, and an iterator that gets assigned from a value-initialized iterator. Testcase: https://gcc.godbolt.org/z/hW7d7Pao3 #define _GLIBCXX_DEBUG #include <map> int main() { using M = std::map<int, int>; using I = M::iterator; M map{ {1, 1}, {2, 2} }; I it1 = map.begin(); it1 = I{}; I it2{}; (void)(it1 == it2); } Results in Error: attempt to compare a singular iterator to a singular (value-initialized) iterator. It's not entirely clear to me why this shouldn't "just workâ˘", although this is probably threading the needle; assignment *from* a singular iterator isn't really discussed in https://eel.is/c++draft/iterator.requirements.general#7 nor in https://eel.is/c++draft/forward.iterators#2 . (One may argue that this last sentence was added by N3644, when iterators still required copiability, so copying a value-constructed iterator should have value semantics and the result be indistinguishable from value-initializing...)