Basic exception example: #include <iostream> #include <string> using namespace std;
int main() { try { throw string("String"); } catch (string s) { cout << "Caught an exception \"" << s << "\"\n"; } } Compiled with: g++ -fexceptions -Wall -o exception exception.cpp Prints: terminate called after throwing an instance of 'std::string' Should print: Caught an exception "String" Exception is never caught. -- Summary: Exceptions not working on FreeBSD Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: yuri at tsoft dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35876