https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71431
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |WAITING --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Could you clarify exactly what you think is a bug then? This example shows that failbit is set on the output stream, as required: #include <fstream> #include <iostream> #include <sstream> int main() { std::ifstream f("."); std::ostringstream ss; ss << f.rdbuf(); std::cout << (bool)f.fail() << '\n'; std::cout << (bool)ss << '\n'; } The standard doesn't say anything about operator<<(basic_streambuf<C,T>*) setting any error bits on the input streambuf if reading characters from it fails.