Unformatted input functions should set eofbit in rdstate() when rdbuf()->sgetc() or rdbuf()->sbumpc() return eof(), but basic_istream::peek() fails to do so.
Created attachment 4769 [details] Test case
Confirmed.
Subject: Bug 12296 CVSROOT: /cvs/gcc Module name: gcc Changes by: paolo@gcc.gnu.org 2003-09-29 17:36:18 Modified files: libstdc++-v3 : ChangeLog libstdc++-v3/include/bits: istream.tcc stl_algo.h Added files: libstdc++-v3/testsuite/27_io/basic_istream/peek/char: 12296.cc libstdc++-v3/testsuite/25_algorithms/search_n: 11400.cc Log message: 2003-09-29 Paolo Carlini <pcarlini@unitus.it> PR libstdc++/12296 * include/bits/istream.tcc (peek): Set eofbit if sgetc returns eof. * testsuite/27_io/basic_istream/peek/char/12296.cc: New, from the PR. 2003-09-29 Nathan Myers <ncm@cantrip.org> Paolo Carlini <pcarlini@unitus.it> PR libstdc++/11400 * include/bits/stl_algo.h (search_n): Use iterator_traits<>::difference_type for __n. * testsuite/25_algorithms/search_n/11400.cc: New, from the PR. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.1973&r2=1.1974 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/istream.tcc.diff?cvsroot=gcc&r1=1.50&r2=1.51 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/stl_algo.h.diff?cvsroot=gcc&r1=1.35&r2=1.36 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/12296.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/25_algorithms/search_n/11400.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed by the patch above.
Subject: Bug 12296 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: paolo@gcc.gnu.org 2003-09-30 14:37:40 Modified files: libstdc++-v3 : ChangeLog libstdc++-v3/include/bits: istream.tcc stl_algo.h Log message: 2003-09-30 Paolo Carlini <pcarlini@unitus.it> PR libstdc++/12296 * include/bits/istream.tcc (peek): Set eofbit if sgetc returns eof. 2003-09-30 Nathan Myers <ncm@cantrip.org> Paolo Carlini <pcarlini@unitus.it> PR libstdc++/11400 * include/bits/stl_algo.h (search_n): Use iterator_traits<>::difference_type for __n. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.1464.2.147&r2=1.1464.2.148 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/istream.tcc.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.36.4.6&r2=1.36.4.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/stl_algo.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.27&r2=1.27.20.1