From 29b40639ed7b6b3c47f8c5bafe15265f8c484ef8 Mon Sep 17 00:00:00 2001 From: Dave Watson Date: Tue, 21 Nov 2017 07:33:09 -0800 Subject: [PATCH] fix hazptr_array move Summary: Broken, found via build failures in D6259947 Reviewed By: yfeldblum Differential Revision: D6374215 fbshipit-source-id: 3a438b5416683c602966c2f029c6b7787acdccaa --- folly/experimental/hazptr/hazptr-impl.h | 5 +++-- folly/experimental/hazptr/test/HazptrTest.cpp | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) 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)); } } -- 2.34.1