https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66145
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Reduced from testcase at https://bugzilla.redhat.com/show_bug.cgi?id=1269290 #include <iostream> #include <fstream> #include <system_error> #include <exception> int main() { try { std::ifstream input("notafile"); input.exceptions(std::ifstream::failbit | std::ifstream::badbit); input.get(); } catch(const std::ios::failure &e) { std::cout << "caught a failure " << e.what() << '\n'; } catch(const std::system_error &e) { std::cout << "caught a system_error " << e.what() << '\n'; } catch(const std::runtime_error &e) { std::cout << "caught a runtime_error " << e.what() << '\n'; } catch(const std::exception &e) { std::cout << "caught an exception " << e.what() << '\n'; } } The last handler matches, but it should have matched earlier.