This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/59170] pretty printers: end iterator invalid pointer
- From: "jan.kratochvil at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 13 Dec 2016 20:26:23 +0000
- Subject: [Bug libstdc++/59170] pretty printers: end iterator invalid pointer
- Auto-submitted: auto-generated
- References: <bug-59170-4@http.gcc.gnu.org/bugzilla/>
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.