From: Dave Watson Date: Tue, 21 Nov 2017 15:33:09 +0000 (-0800) Subject: fix hazptr_array move X-Git-Tag: v2017.11.27.00~10 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=29b40639ed7b6b3c47f8c5bafe15265f8c484ef8 fix hazptr_array move Summary: Broken, found via build failures in D6259947 Reviewed By: yfeldblum Differential Revision: D6374215 fbshipit-source-id: 3a438b5416683c602966c2f029c6b7787acdccaa --- diff --git a/folly/experimental/hazptr/hazptr-impl.h b/folly/experimental/hazptr/hazptr-impl.h index 823f2ebf..07564a43 100644 --- a/folly/experimental/hazptr/hazptr-impl.h +++ b/folly/experimental/hazptr/hazptr-impl.h @@ -452,9 +452,10 @@ FOLLY_ALWAYS_INLINE hazptr_array::hazptr_array( hazptr_array&& other) noexcept { DEBUG_PRINT(this << " " << M << " " << &other); auto h = reinterpret_cast(&raw_); + auto hother = reinterpret_cast(&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; diff --git a/folly/experimental/hazptr/test/HazptrTest.cpp b/folly/experimental/hazptr/test/HazptrTest.cpp index 89ddc023..1541201c 100644 --- a/folly/experimental/hazptr/test/HazptrTest.cpp +++ b/folly/experimental/hazptr/test/HazptrTest.cpp @@ -380,6 +380,7 @@ TEST_F(HazptrTest, Array) { { // Abnormal case hazptr_array h; + hazptr_array h2(std::move(h)); } }