#include <iostream> using namespace std; struct S { S ( int a) { try { if (a > 0) throw *this; else if (a < 0) throw 0; } catch ( S & ) { cout << “SCatch_S&” << endl; } catch (int) { throw; } cout << “SConstr” << endl; } S (const S & a) { cout << “Copy” << endl; } ~S ( ) { cout << “Destr” << endl; } }; int main() { try { S s1(1), s2(-2); cout << “Main” << endl; } catch (S &) { cout << “MainCatch_S&” << endl; } catch ( ... ) { cout << “MainCatch_...” << endl; } return 0; }
Standard input is empty
prog.cpp:8:1: error: stray ‘\342’ in program
catch ( S & ) { cout << “SCatch_S&” << endl; }
^
prog.cpp:8:1: error: stray ‘\200’ in program
prog.cpp:8:1: error: stray ‘\234’ in program
prog.cpp:8:1: error: stray ‘\342’ in program
prog.cpp:8:1: error: stray ‘\200’ in program
prog.cpp:8:1: error: stray ‘\235’ in program
prog.cpp:10:1: error: stray ‘\342’ in program
cout << “SConstr” << endl;
^
prog.cpp:10:1: error: stray ‘\200’ in program
prog.cpp:10:1: error: stray ‘\234’ in program
prog.cpp:10:1: error: stray ‘\342’ in program
prog.cpp:10:1: error: stray ‘\200’ in program
prog.cpp:10:1: error: stray ‘\235’ in program
prog.cpp:12:1: error: stray ‘\342’ in program
S (const S & a) { cout << “Copy” << endl; }
^
prog.cpp:12:1: error: stray ‘\200’ in program
prog.cpp:12:1: error: stray ‘\234’ in program
prog.cpp:12:1: error: stray ‘\342’ in program
prog.cpp:12:1: error: stray ‘\200’ in program
prog.cpp:12:1: error: stray ‘\235’ in program
prog.cpp:13:1: error: stray ‘\342’ in program
~S ( ) { cout << “Destr” << endl; }
^
prog.cpp:13:1: error: stray ‘\200’ in program
prog.cpp:13:1: error: stray ‘\234’ in program
prog.cpp:13:1: error: stray ‘\342’ in program
prog.cpp:13:1: error: stray ‘\200’ in program
prog.cpp:13:1: error: stray ‘\235’ in program
prog.cpp:17:1: error: stray ‘\342’ in program
cout << “Main” << endl;
^
prog.cpp:17:1: error: stray ‘\200’ in program
prog.cpp:17:1: error: stray ‘\234’ in program
prog.cpp:17:1: error: stray ‘\342’ in program
prog.cpp:17:1: error: stray ‘\200’ in program
prog.cpp:17:1: error: stray ‘\235’ in program
prog.cpp:19:1: error: stray ‘\342’ in program
catch (S &) { cout << “MainCatch_S&” << endl; }
^
prog.cpp:19:1: error: stray ‘\200’ in program
prog.cpp:19:1: error: stray ‘\234’ in program
prog.cpp:19:1: error: stray ‘\342’ in program
prog.cpp:19:1: error: stray ‘\200’ in program
prog.cpp:19:1: error: stray ‘\235’ in program
prog.cpp:20:1: error: stray ‘\342’ in program
catch ( ... ) { cout << “MainCatch_...” << endl; }
^
prog.cpp:20:1: error: stray ‘\200’ in program
prog.cpp:20:1: error: stray ‘\234’ in program
prog.cpp:20:1: error: stray ‘\342’ in program
prog.cpp:20:1: error: stray ‘\200’ in program
prog.cpp:20:1: error: stray ‘\235’ in program
prog.cpp: In constructor ‘S::S(int)’:
prog.cpp:8:28: error: ‘SCatch_S’ was not declared in this scope
catch ( S & ) { cout << “SCatch_S&” << endl; }
^
prog.cpp:8:41: error: expected primary-expression before ‘<<’ token
catch ( S & ) { cout << “SCatch_S&” << endl; }
^
prog.cpp:10:12: error: ‘SConstr’ was not declared in this scope
cout << “SConstr” << endl;
^
prog.cpp: In copy constructor ‘S::S(const S&)’:
prog.cpp:12:30: error: ‘Copy’ was not declared in this scope
S (const S & a) { cout << “Copy” << endl; }
^
prog.cpp: In destructor ‘S::~S()’:
prog.cpp:13:21: error: ‘Destr’ was not declared in this scope
~S ( ) { cout << “Destr” << endl; }
^
prog.cpp: In function ‘int main()’:
prog.cpp:17:12: error: ‘Main’ was not declared in this scope
cout << “Main” << endl;
^
prog.cpp:19:26: error: ‘MainCatch_S’ was not declared in this scope
catch (S &) { cout << “MainCatch_S&” << endl; }
^
prog.cpp:19:42: error: expected primary-expression before ‘<<’ token
catch (S &) { cout << “MainCatch_S&” << endl; }
^
prog.cpp:20:28: error: ‘MainCatch_’ was not declared in this scope
catch ( ... ) { cout << “MainCatch_...” << endl; }
^
prog.cpp:20:38: error: expected ‘;’ before ‘...’ token
catch ( ... ) { cout << “MainCatch_...” << endl; }
^
Standard output is empty