diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2016-06-16 21:45:13 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2016-06-16 21:45:13 +0000 |
commit | 660b1a49dc4f387f9fc42631ed832f53d00ff44f (patch) | |
tree | 02efe68f9f4383918365576baf29197a575750c3 /llvm/unittests/ADT/BitVectorTest.cpp | |
parent | 8dad57cc49f2463356210016b9a692611082b656 (diff) | |
download | bcm5719-llvm-660b1a49dc4f387f9fc42631ed832f53d00ff44f.tar.gz bcm5719-llvm-660b1a49dc4f387f9fc42631ed832f53d00ff44f.zip |
Fix BitVector move ctor/assignment.
Current implementation leaves the object in an invalid state.
This reverts commit bf0c389ac683cd6c0e5959b16537e59e5f4589e3.
llvm-svn: 272965
Diffstat (limited to 'llvm/unittests/ADT/BitVectorTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/BitVectorTest.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/BitVectorTest.cpp b/llvm/unittests/ADT/BitVectorTest.cpp index 95ff93fa9c4..78fd5ce6567 100644 --- a/llvm/unittests/ADT/BitVectorTest.cpp +++ b/llvm/unittests/ADT/BitVectorTest.cpp @@ -399,5 +399,31 @@ TYPED_TEST(BitVectorTest, CompoundTestReset) { C.reset(C); EXPECT_TRUE(C.none()); } + +TYPED_TEST(BitVectorTest, MoveConstructor) { + TypeParam A(10, true); + TypeParam B(std::move(A)); + // Check that the move ctor leaves the moved-from object in a valid state. + // The following line used to crash. + A = B; + + TypeParam C(10, true); + EXPECT_EQ(C, A); + EXPECT_EQ(C, B); +} + +TYPED_TEST(BitVectorTest, MoveAssignment) { + TypeParam A(10, true); + TypeParam B; + B = std::move(A); + // Check that move assignment leaves the moved-from object in a valid state. + // The following line used to crash. + A = B; + + TypeParam C(10, true); + EXPECT_EQ(C, A); + EXPECT_EQ(C, B); +} + } #endif |