https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59170
--- Comment #12 from Jan Kratochvil <jan.kratochvil at redhat dot com> --- (In reply to Jonathan Wakely from comment #7) > That doesn't help: > > std::vector<int>::iterator it; > { > std::vector<int> v{1}; > it = v.begin(); > } > > The iterator is safely initialized, safely updated to a valid value, but is > not dereferenceable after the last statement. > > "print it" should not automatically dereference. Therefore (at least with -D_GLIBCXX_DEBUG) "print it" (IMO) should automatically dereference as it is safe - the iterator always does know if it is valid or not.