https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111681
Bug ID: 111681 Summary: Missing fixit for exception name in catch Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sjames at gcc dot gnu.org CC: dmalcolm at gcc dot gnu.org Target Milestone: --- Noticed with a Blender issue w/ GCC 13 (missing transitive include for <system_error>, https://bugs.gentoo.org/914740). If I just take the example at https://en.cppreference.com/w/cpp/error/system_error and mangle it, I get: ``` #include <thread> int main() { try { std::thread().detach(); // attempt to detach a non-thread } catch(const std::system_error& e) { std::cout << "Caught system_error with code " "[" << e.code() << "] meaning " "[" << e.what() << "]\n"; } } ``` with: ``` $ g++-14 /tmp/foo.cxx -o /tmp/foo /tmp/foo.cxx: In function ‘int main()’: /tmp/foo.cxx:9:34: error: expected unqualified-id before ‘&’ token 9 | catch(const std::system_error& e) | ^ /tmp/foo.cxx:9:34: error: expected ‘)’ before ‘&’ token 9 | catch(const std::system_error& e) | ~ ^ | ) /tmp/foo.cxx:9:34: error: expected ‘{’ before ‘&’ token /tmp/foo.cxx:9:36: error: ‘e’ was not declared in this scope 9 | catch(const std::system_error& e) | ^ ``` The error message here could be better, but even better would be a fixit saying to include <system_error>.