diff options
Diffstat (limited to 'testsuites/libtests/dl05/dl-cpp.cpp')
-rw-r--r-- | testsuites/libtests/dl05/dl-cpp.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/testsuites/libtests/dl05/dl-cpp.cpp b/testsuites/libtests/dl05/dl-cpp.cpp index fcb9e0af06..0e2005713e 100644 --- a/testsuites/libtests/dl05/dl-cpp.cpp +++ b/testsuites/libtests/dl05/dl-cpp.cpp @@ -4,11 +4,27 @@ #include <cstdio> #include <stdexcept> #include "dl-load.h" -void exception_base(bool istrue) +void exception_base(bool throw_runtime) { - printf("exception_base called\n"); - if (istrue) + printf("%s: begin\n", __func__); + try { - throw std::runtime_error("dummy call to link in symbols"); + 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__); } |