std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode -----------------------------------------------------------------
Key: STDCXX-522 URL: https://issues.apache.org/jira/browse/STDCXX-522 Project: C++ Standard Library Issue Type: Bug Components: 27. Input/Output Affects Versions: 4.1.3, 4.1.4 Reporter: Martin Sebor The program below should run successfully to completion but instead it aborts (both in 4.1.3 and on trunk): $ cat t.cpp && make t && LD_LIBRARY_PATH=../lib ./t #include <cassert> #include <fstream> #include <ios> int main () { struct: std::filebuf { int_type overflow (int_type c) { return std::filebuf::overflow (c); } } buf; buf.open ("file", std::ios::out); buf.pubsetbuf (0, 0); buf.overflow (std::filebuf::traits_type::eof ()); buf.close (); std::ifstream in ("file"); assert (std::istream::traits_type::eof () == in.get ()); } gcc -c -I/amd/devco/sebor/stdcxx-4.1.3/include/ansi -D_RWSTDDEBUG -pthread -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/include -I/amd/devco/sebor/stdcxx-4.1.3/include -I/amd/devco/sebor/stdcxx-4.1.3/examples/include -pedantic -nostdinc++ -g -m64 -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align t.cpp gcc t.o -o t -pthread -m64 -L/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/lib -lstd15D -lsupc++ -lm t: t.cpp:19: int main(): Assertion `std::istream::traits_type::eof () == in.get ()' failed. Aborted -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.