@with_both_exception_handling
def test_exceptions_3(self):
    src = '\n#include <iostream>\n#include <stdexcept>\n\nint main(int argc, char **argv)\n{\n  if (argc != 2) {\n    std::cout << "need an arg" << std::endl;\n    return 1;\n  }\n\n  int arg = argv[1][0] - \'0\';\n  try {\n    if (arg == 0) throw "a c string";\n    if (arg == 1) throw std::exception();\n    if (arg == 2) throw std::runtime_error("Hello");\n  } catch(const char * ex) {\n    std::cout << "Caught C string: " << ex << std::endl;\n  } catch(const std::exception &ex) {\n    std::cout << "Caught exception: " << ex.what() << std::endl;\n  } catch(...) {\n    std::cout << "Caught something else" << std::endl;\n  }\n\n  std::cout << "Done.\\n";\n}\n'
    print('0')
    self.do_run(src, 'Caught C string: a c string\nDone.', ['0'])
    print('1')
    self.do_run(None, 'Caught exception: std::exception\nDone.', ['1'], no_build=True)
    print('2')
    self.do_run(None, 'Caught exception: Hello\nDone.', ['2'], no_build=True)
@with_both_exception_handling
def test_exceptions_3(self):
    src = '\n#include <iostream>\n#include <stdexcept>\n\nint main(int argc, char **argv)\n{\n  if (argc != 2) {\n    std::cout << "need an arg" << std::endl;\n    return 1;\n  }\n\n  int arg = argv[1][0] - \'0\';\n  try {\n    if (arg == 0) throw "a c string";\n    if (arg == 1) throw std::exception();\n    if (arg == 2) throw std::runtime_error("Hello");\n  } catch(const char * ex) {\n    std::cout << "Caught C string: " << ex << std::endl;\n  } catch(const std::exception &ex) {\n    std::cout << "Caught exception: " << ex.what() << std::endl;\n  } catch(...) {\n    std::cout << "Caught something else" << std::endl;\n  }\n\n  std::cout << "Done.\\n";\n}\n'
    print('0')
    self.do_run(src, 'Caught C string: a c string\nDone.', ['0'])
    print('1')
    self.do_run(None, 'Caught exception: std::exception\nDone.', ['1'], no_build=True)
    print('2')
    self.do_run(None, 'Caught exception: Hello\nDone.', ['2'], no_build=True)