https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71950
Bug ID: 71950 Summary: std::ios_base::failure.what() returns irrelevant error message Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: sytelus at gmail dot com Target Milestone: --- The what() method of exception class std::ios_base::failure should return helpful error messages indicating why IO operation failed. At present it returns irrelevant and unhelpful message such as "basic_ios::clear". Below is the code to reproduce this bug: #include <iostream> #include <fstream> int main() { try { std::ofstream flog; flog.exceptions(flog.exceptions() | std::ios::failbit | std::ifstream::badbit); flog.open("~/bad/path/xyz.tsv", std::ios::trunc); } catch (const std::ios_base::failure &ex) { std::cout << ex.what(); } }