77#include < boost/openmethod/preamble.hpp>
88#include < boost/openmethod/policies/throw_error_handler.hpp>
99#include < boost/openmethod/initialize.hpp>
10- #include < boost/openmethod/interop/std_unique_ptr .hpp>
10+ #include < boost/openmethod/interop/std_shared_ptr .hpp>
1111
1212#include " test_util.hpp"
1313
@@ -72,8 +72,8 @@ BOOST_AUTO_TEST_CASE(no_initialization) {
7272 {
7373 registry::capture capture;
7474 BOOST_CHECK_THROW (
75- (unique_virtual_ptr <matrix, registry>{
76- std::make_unique <diagonal_matrix>()}),
75+ (shared_virtual_ptr <matrix, registry>{
76+ std::make_shared <diagonal_matrix>()}),
7777 not_initialized);
7878 BOOST_TEST (capture () == " not initialized\n " );
7979 }
@@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE(no_initialization) {
8282 {
8383 registry::capture capture;
8484 BOOST_CHECK_THROW (
85- transpose (make_unique_virtual <diagonal_matrix, registry>()),
85+ transpose (make_shared_virtual <diagonal_matrix, registry>()),
8686 not_initialized);
8787 }
8888 } else {
@@ -214,6 +214,39 @@ BOOST_AUTO_TEST_CASE(bad_call_type_ids) {
214214
215215namespace TEST_NS {
216216
217+ using namespace test_matrices ;
218+ using registry = errors_<__COUNTER__>;
219+
220+ BOOST_OPENMETHOD_CLASSES (matrix, dense_matrix, diagonal_matrix, registry);
221+
222+ BOOST_OPENMETHOD (
223+ times,
224+ (shared_virtual_ptr<const matrix, registry>,
225+ shared_virtual_ptr<const matrix, registry>),
226+ void , registry);
227+
228+ BOOST_AUTO_TEST_CASE (bad_call_type_ids_smart_ptr) {
229+ initialize<registry>();
230+ registry::capture capture;
231+
232+ try {
233+ auto a = make_shared_virtual<const diagonal_matrix, registry>();
234+ auto b = make_shared_virtual<const diagonal_matrix, registry>();
235+ times (a, b);
236+ BOOST_FAIL (" should have thrown" );
237+ } catch (const no_overrider& error) {
238+ BOOST_TEST (error.arity == 2u );
239+ BOOST_TEST (error.types [0 ] == &typeid (diagonal_matrix));
240+ BOOST_TEST (error.types [1 ] == &typeid (diagonal_matrix));
241+ } catch (...) {
242+ BOOST_FAIL (" wrong exception" );
243+ }
244+ }
245+
246+ } // namespace TEST_NS
247+
248+ namespace TEST_NS {
249+
217250using namespace test_matrices ;
218251struct registry
219252 : test_registry_<__COUNTER__>::with<policies::throw_error_handler> {};
0 commit comments