diff --git a/tests/ffi/lib.rs b/tests/ffi/lib.rs index cabcdbc4..d6be0979 100644 --- a/tests/ffi/lib.rs +++ b/tests/ffi/lib.rs @@ -276,6 +276,8 @@ pub mod ffi { struct Dag4 { dag0: Dag0, } + + impl Box {} } mod other { diff --git a/tests/ffi/tests.cc b/tests/ffi/tests.cc index 2be1e061..2834801a 100644 --- a/tests/ffi/tests.cc +++ b/tests/ffi/tests.cc @@ -50,6 +50,15 @@ Shared c_return_shared() { return Shared{2020}; } ::A::B::ABShared c_return_nested_ns_shared() { return ::A::B::ABShared{2020}; } rust::Box c_return_box() { + Shared shared{0}; + rust::Box box{shared}; // explicit constructor from const T& + rust::Box other{std::move(shared)}; // explicit constructor from T&& + box = other; // copy assignment + box = std::move(other); // move assignment + rust::Box box2(box); // copy constructor + rust::Box other2(std::move(other)); // move constructor + rust::Box::in_place(shared.z); // placement static factory + rust::Box::in_place(0); return rust::Box::from_raw(cxx_test_suite_get_box()); }