llvm.org GIT mirror llvm / 7dd4ca2
[ADT] Fix OwningArrayRef's move ctor git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358332 91177308-0d34-0410-b5e6-96231b3b80d8 Fangrui Song 4 months ago
2 changed file(s) with 8 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
429429 std::copy(Data.begin(), Data.end(), this->begin());
430430 }
431431
432 OwningArrayRef(OwningArrayRef &&Other) { *this = Other; }
432 OwningArrayRef(OwningArrayRef &&Other) { *this = std::move(Other); }
433433
434434 OwningArrayRef &operator=(OwningArrayRef &&Other) {
435435 delete[] this->data();
247247 EXPECT_TRUE(AR2.equals(AR2Ref));
248248 }
249249
250 TEST(ArrayRefTest, OwningArrayRef) {
251 static const int A1[] = {0, 1};
252 OwningArrayRef A(makeArrayRef(A1));
253 OwningArrayRef B(std::move(A));
254 EXPECT_EQ(A.data(), nullptr);
255 }
256
250257 static_assert(is_trivially_copyable>::value,
251258 "trivially copyable");
252259