https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105580

--- Comment #12 from Tomasz KamiƄski <tkaminsk at gcc dot gnu.org> ---
> The theory of the warning seems to be that if istreambuf_iterator::_M_get, 
> called from operator* for *__beg in _M_construct, hits EOF, it clears 
> _M_sbuf, and then ++__beg will try to refer to members of the now-null 
> __beg._M_sbuf.  At first glance, this seems like a plausible theory.  Why 
> does _M_get clear _M_sbuf?

For any iterator for which *__beg hits EOF, the __beg == istream_iterator() is
true, so we never deference or increment such pointer in _M_construct, as we
guard them with __beg != __end. So this warning is false-positive. However, as
sgetc() is virtual function call I am not suprised that this information wasn't
propagated correctly.

Reply via email to