On 23/09/17 09:54 +0300, Petr Ovtchenkov wrote:
istreambuf_iterator should not forget about attached streambuf when it reach EOF.Checks in debug mode has no infuence more on character extraction in istreambuf_iterator increment operators. In this aspect behaviour in debug and non-debug mode is similar now. Test for detached srteambuf in istreambuf_iterator: When istreambuf_iterator reach EOF of istream, it should not forget about attached streambuf. From fact "EOF in stream reached" not follow that stream reach end of life and input operation impossible more. --- libstdc++-v3/include/bits/streambuf_iterator.h | 41 +++++++-------- .../24_iterators/istreambuf_iterator/3.cc | 61 ++++++++++++++++++++++ 2 files changed, 80 insertions(+), 22 deletions(-) create mode 100644 libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/3.cc diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h b/libstdc++-v3/include/bits/streambuf_iterator.h index f0451b1..45c3d89 100644 --- a/libstdc++-v3/include/bits/streambuf_iterator.h +++ b/libstdc++-v3/include/bits/streambuf_iterator.h @@ -136,12 +136,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION istreambuf_iterator& operator++() { - __glibcxx_requires_cond(!_M_at_eof(), + __glibcxx_requires_cond(_M_sbuf, _M_message(__gnu_debug::__msg_inc_istreambuf) ._M_iterator(*this)); if (_M_sbuf) { +#ifdef _GLIBCXX_DEBUG_PEDANTIC + int_type _tmp =
_tmp is not a reserved name, this needs to be __tmp. I'm still reviewing the rest, to understand what observable behaviour this changes, and how it differs from the patch François sent.
