This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/59170] pretty printers: end iterator invalid pointer


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]