diff options
Diffstat (limited to 'testsuites/libtests/dl05/dl-cpp.cc')
-rw-r--r-- | testsuites/libtests/dl05/dl-cpp.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuites/libtests/dl05/dl-cpp.cc b/testsuites/libtests/dl05/dl-cpp.cc new file mode 100644 index 0000000000..0e2005713e --- /dev/null +++ b/testsuites/libtests/dl05/dl-cpp.cc @@ -0,0 +1,30 @@ +/* + * The base image needs this to include the RTTI data. + */ +#include <cstdio> +#include <stdexcept> +#include "dl-load.h" +void exception_base(bool throw_runtime) +{ + printf("%s: begin\n", __func__); + try + { + if (throw_runtime) + throw std::runtime_error("eb: throw std::runtime_error"); + else + throw dl_test_throw_me("eb: throw me"); + } + catch (std::exception const& e) + { + printf("%s: caught: %s\n", __func__, e.what()); + } + catch (dl_test_throw_me const& e) + { + printf("%s: caught: %s\n", __func__, e.what()); + } + catch (...) + { + printf("%s: caught: unknown\n", __func__); + } + printf("%s: end\n", __func__); +} |