id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 4728,"""iostreams::detail::mode_adapter<>"" is never ""flushable"": flushing a filtering_ostream will not flush the ""std::ostream"" target --- patch included.",Duncan Exon Smith ,Jonathan Turkanis,"I have found a problem with Boost.Iostreams. * I'm using Boost v1.43.0 on Gentoo Linux with `gcc-4.3.4`. * I've reproduced it with `gcc-4.4.3`. * I've reproduced it with Boost v1.44.0 (from the website tarball). * Let me know if you need to know anything else about my environment. * A simple testcases attached at [attachment:boost_iostreams_filtering_std_ostream.cpp]. * A patch to fix the problem is attached at [attachment:boost_iostreams-mode_adaptor-flushable.patch]. * This is a different problem from #4590. === Details === I'm going to use `io` as a synonym for the `boost::iostreams` namespace. I have come across a problem with `io::detail::mode_adapter`, where `T` is a `std::ostream` or a `std::streambuf`. I came across the problem in `io::filtering_ostream`, but perhaps this class is used elsewhere also. * `io::detail::mode_adapter<>::category` is not convertible to any of `io::flushable_tag`, `io::ostream_tag`, or `io::streambuf_tag`. * `io::flush()` will use `io::detail::flush_device_impl::flush()` for `mode_adapter<, T>` even when `T::catagory` is convertible `flushable_tag`, `ostream_tag` or `streambuf_tag`. * As a result, `io::filtering_ostream` will not flush correctly when the device at the end of the chain is a non-boost `std::ostream` or a `std::streambuf`. * I expect, also, that any filters in the chain that inherit from `flushable_tag` also do not get flushed correctly. * In particular the following methods from the STL `std::ostream` interface will ''not'' flush the stream to the device: {{{ #!cpp std::ostream stream(&someBuffer); io::filtering_ostream out; out.push(stream); // These STL methods of flushing a stream will NOT flush ""stream"". out << std::endl; out.flush(); }}} * My solution is to have `mode_adapter<>::category` inherit from `flushable_tag` when appropriate, and to implement `::flush()` methods: {{{ #!cpp }}}",Bugs,new,To Be Determined,iostreams,Boost Development Trunk,Problem,,,boost-bugs@…