https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127540
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #5) > So I think the fix is just to say that for our safe iterators, the > moved-from state is equivalent to the value-initialized state. That's not guaranteed by the standard, it can be any valid state. But a valid state has to be copyable and movable. We could introduce a new state, so we would have non-singular, and singular, and singular but value-initialized, and a new singular but moved-from state. But I don't see much benefit to that. Because we can't abort the program when copying a moved-from iterator, we have to allow it in almost all the same places that we allow value-initialized (the exception would be in equality comparisons, which don't need to work for moved-from iterators). So we would need an ABI change to store a flag for the new state (not necessarily a problem, as we don't promise ABI stability for debug mode), and we would need to modify most assertions to also check for the moved-from state, and the only benefit would be diagnosing comparisons involving moved-from iterators. That benefit seems unlikely to catch many bugs. So I suggest that we just define the moved-from state as value-initialized, and accept that some rare misuses will not be diagnosed.
