mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-23 23:29:50 +00:00
Add Box construction tests
This commit is contained in:
parent
0f1ac8b3fd
commit
a141674f56
@ -276,6 +276,8 @@ pub mod ffi {
|
||||
struct Dag4 {
|
||||
dag0: Dag0,
|
||||
}
|
||||
|
||||
impl Box<Shared> {}
|
||||
}
|
||||
|
||||
mod other {
|
||||
|
@ -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<R> c_return_box() {
|
||||
Shared shared{0};
|
||||
rust::Box<Shared> box{shared}; // explicit constructor from const T&
|
||||
rust::Box<Shared> other{std::move(shared)}; // explicit constructor from T&&
|
||||
box = other; // copy assignment
|
||||
box = std::move(other); // move assignment
|
||||
rust::Box<Shared> box2(box); // copy constructor
|
||||
rust::Box<Shared> other2(std::move(other)); // move constructor
|
||||
rust::Box<Shared>::in_place(shared.z); // placement static factory
|
||||
rust::Box<Shared>::in_place<size_t>(0);
|
||||
return rust::Box<R>::from_raw(cxx_test_suite_get_box());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user