Fix: BLI: Assert in generic array move constructor
When assigning a default constructed virtual array, an assert checking for a non-null type was triggered.
This commit is contained in:
@@ -99,7 +99,8 @@ class GArray {
|
||||
/**
|
||||
* Create an array by taking ownership of another array's data, clearing the data in the other.
|
||||
*/
|
||||
GArray(GArray &&other) : GArray(other.type(), other.data(), other.size(), other.allocator())
|
||||
GArray(GArray &&other)
|
||||
: type_(other.type_), data_(other.data_), size_(other.size_), allocator_(other.allocator_)
|
||||
{
|
||||
other.data_ = nullptr;
|
||||
other.size_ = 0;
|
||||
|
||||
@@ -125,4 +125,12 @@ TEST(generic_array, ReinitEmpty)
|
||||
EXPECT_EQ(array.as_span().typed<int>()[9], 7);
|
||||
}
|
||||
|
||||
TEST(generic_array, AssignDefault)
|
||||
{
|
||||
GArray<> array(CPPType::get<int32_t>(), int64_t(5));
|
||||
array = {};
|
||||
EXPECT_EQ(array.size(), 0);
|
||||
EXPECT_EQ(array.data(), nullptr);
|
||||
}
|
||||
|
||||
} // namespace blender::tests
|
||||
|
||||
Reference in New Issue
Block a user