summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2021-07-12 19:24:52 +0200
committerGitHub <noreply@github.com>2021-07-12 19:24:52 +0200
commit9353fd37a5e1eec4472c2e444598578ceb28e2c0 (patch)
tree58c7312d83e06b9e07a25f7bb3c94ea58e092c8f
parentf0365b24d59641a977e51b1316299917a956717b (diff)
parentee05329751aa33e1624970de84345b085ec1b8f1 (diff)
downloadATCD-9353fd37a5e1eec4472c2e444598578ceb28e2c0.tar.gz
Merge pull request #1601 from jwillemsen/jwi-dlltest2
Further extend DLL test with exceptions
-rw-r--r--ACE/tests/DLL_Test_Impl.cpp13
-rw-r--r--ACE/tests/DLL_Test_Parent.cpp5
-rw-r--r--ACE/tests/DLL_Test_Parent.h1
3 files changed, 18 insertions, 1 deletions
diff --git a/ACE/tests/DLL_Test_Impl.cpp b/ACE/tests/DLL_Test_Impl.cpp
index d91abff98f7..23f503e3491 100644
--- a/ACE/tests/DLL_Test_Impl.cpp
+++ b/ACE/tests/DLL_Test_Impl.cpp
@@ -76,7 +76,7 @@ Hello_Impl::operator delete (void *ptr)
}
extern "C" ACE_Svc_Export Hello *
-get_hello (void)
+get_hello ()
{
Hello *hello {};
@@ -160,6 +160,17 @@ Child::test ()
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("caught derived as base\n")));
}
+ std::unique_ptr<Base> derived_excep_alloc (Derived::_alloc ());
+ try
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("throwing derived exception allocated with _alloc\n")));
+ derived_excep_base->_raise();
+ }
+ catch (const Derived&)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("caught derived exception\n")));
+ }
+
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("testing exceptions finished\n")));
}
diff --git a/ACE/tests/DLL_Test_Parent.cpp b/ACE/tests/DLL_Test_Parent.cpp
index 4f2e4aacac8..f680378c4e1 100644
--- a/ACE/tests/DLL_Test_Parent.cpp
+++ b/ACE/tests/DLL_Test_Parent.cpp
@@ -35,3 +35,8 @@ Derived::_raise () const
throw *this;
}
+Base*
+Derived::_alloc()
+{
+ return new Derived();
+}
diff --git a/ACE/tests/DLL_Test_Parent.h b/ACE/tests/DLL_Test_Parent.h
index c9c36b95b7f..bb4cf4e4e79 100644
--- a/ACE/tests/DLL_Test_Parent.h
+++ b/ACE/tests/DLL_Test_Parent.h
@@ -53,6 +53,7 @@ class DLL_Test_Parent_Export Derived : public Base
{
public:
Derived ();
+ static Base* _alloc ();
void _raise () const override;
~Derived () override = default;
};