diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-18 17:58:37 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-18 17:58:37 +0000 |
commit | c4624f858cf33df141e17ad649a01fd5aaece676 (patch) | |
tree | 5b8039dd8e3565b2f8c58dff6b3f92f7c7ac5803 | |
parent | 049898ae9dbdd34fbbd96797d203ff8be0498100 (diff) | |
download | gcc-c4624f858cf33df141e17ad649a01fd5aaece676.tar.gz |
2001-07-18 Stephen M. Webb <stephen@bregmasoft..com>
Roman Sulzhyk <roman_sulzhyk@yahoo.com>
libstdc++/3599
* include/bits/ostream.tcc (ostream::put): Fixed error condition check.
* testsuite/27_io/streambuf.cc (test07): Added new regression test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44122 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/ostream.tcc | 2 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/streambuf.cc | 26 |
3 files changed, 34 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ff2efd386c7..dda8697c157 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2001-07-18 Stephen M. Webb <stephen@bregmasoft..com> + Roman Sulzhyk <roman_sulzhyk@yahoo.com> + + libstdc++/3599 + * include/bits/ostream.tcc (ostream::put): Fixed error condition check. + * testsuite/27_io/streambuf.cc (test07): Added new regression test. + 2001-07-17 Stephen M. Webb <stephen@bregmasoft.com>r All occurrences of the __value_type() and __distance_type() diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc index c3cb5d2dced..c24f2953005 100644 --- a/libstdc++-v3/include/bits/ostream.tcc +++ b/libstdc++-v3/include/bits/ostream.tcc @@ -358,7 +358,7 @@ namespace std if (__cerb) { int_type __put = rdbuf()->sputc(__c); - if (__put != traits_type::to_int_type(__c)) + if (traits_type::eq_int_type(__put, traits_type::eof())) this->setstate(ios_base::badbit); } return *this; diff --git a/libstdc++-v3/testsuite/27_io/streambuf.cc b/libstdc++-v3/testsuite/27_io/streambuf.cc index 038c12c9502..68456432b73 100644 --- a/libstdc++-v3/testsuite/27_io/streambuf.cc +++ b/libstdc++-v3/testsuite/27_io/streambuf.cc @@ -337,6 +337,30 @@ namespace gnu class gnu::something_derived : std::streambuf { }; #endif +// libstdc++/3599 +class testbuf2 : public std::streambuf +{ +public: + typedef std::streambuf::traits_type traits_type; + + testbuf2() : std::streambuf() { } + +protected: + int_type + overflow(int_type c = traits_type::eof()) + { return traits_type::not_eof(0); } +}; + +void +test07() +{ + testbuf2 ob; + std::ostream out(&ob); + + VERIFY(out << "gasp"); + VERIFY(out << std::endl); +} + int main() { test01(); @@ -345,5 +369,7 @@ int main() test04(); test05(); + + test07(); return 0; } |