Commit 29b40639 authored by Dave Watson's avatar Dave Watson Committed by Facebook Github Bot

fix hazptr_array move

Summary: Broken, found via build failures in D6259947

Reviewed By: yfeldblum

Differential Revision: D6374215

fbshipit-source-id: 3a438b5416683c602966c2f029c6b7787acdccaa
parent 0f122a82
......@@ -452,9 +452,10 @@ FOLLY_ALWAYS_INLINE hazptr_array<M>::hazptr_array(
hazptr_array&& other) noexcept {
DEBUG_PRINT(this << " " << M << " " << &other);
auto h = reinterpret_cast<hazptr_holder*>(&raw_);
auto hother = reinterpret_cast<hazptr_holder*>(&other.raw_);
for (size_t i = 0; i < M; ++i) {
new (&h[i]) hazptr_holder(std::move(other.h_[i]));
DEBUG_PRINT(i << " " << &h[i] << " " << &other.h_[i]);
new (&h[i]) hazptr_holder(std::move(hother[i]));
DEBUG_PRINT(i << " " << &h[i] << " " << &hother[i]);
}
empty_ = other.empty_;
other.empty_ = true;
......
......@@ -380,6 +380,7 @@ TEST_F(HazptrTest, Array) {
{
// Abnormal case
hazptr_array<HAZPTR_TC_SIZE + 1> h;
hazptr_array<HAZPTR_TC_SIZE + 1> h2(std::move(h));
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment