diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index 61cc37d16d5..7a42a56c332 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h @@ -2823,10 +2823,9 @@ class raw_hash_set { // `that` must be left valid. If Hash is std::function, moving it // would create a nullptr functor that cannot be called. // Note: we avoid using exchange for better generated code. - settings_((that.AssertNotDebugCapacity(), - PolicyTraits::transfer_uses_memcpy() || !that.is_full_soo() - ? std::move(that.common()) - : CommonFields{full_soo_tag_t{}}), + settings_(PolicyTraits::transfer_uses_memcpy() || !that.is_full_soo() + ? std::move(that.common()) + : CommonFields{full_soo_tag_t{}}, that.hash_ref(), that.eq_ref(), that.alloc_ref()) { if (!PolicyTraits::transfer_uses_memcpy() && that.is_full_soo()) { transfer(soo_slot(), that.soo_slot()); @@ -2838,7 +2837,6 @@ class raw_hash_set { raw_hash_set(raw_hash_set&& that, const allocator_type& a) : settings_(CommonFields::CreateDefault(), that.hash_ref(), that.eq_ref(), a) { - that.AssertNotDebugCapacity(); if (a == that.alloc_ref()) { swap_common(that); annotate_for_bug_detection_on_move(that); @@ -2865,7 +2863,8 @@ class raw_hash_set { absl::allocator_traits::is_always_equal::value && std::is_nothrow_move_assignable::value && std::is_nothrow_move_assignable::value) { - that.AssertNotDebugCapacity(); + // TODO(sbenza): We should only use the operations from the noexcept clause + // to make sure we actually adhere to that contract. // NOLINTNEXTLINE: not returning *this for performance. return move_assign( std::move(that), diff --git a/absl/container/internal/raw_hash_set_test.cc b/absl/container/internal/raw_hash_set_test.cc index 548a8332ec3..1d0af3f7df2 100644 --- a/absl/container/internal/raw_hash_set_test.cc +++ b/absl/container/internal/raw_hash_set_test.cc @@ -3715,8 +3715,6 @@ TEST(Table, MovedFromCallsFail) { EXPECT_DEATH_IF_SUPPORTED(t1.end(), "moved-from"); // NOLINTNEXTLINE(bugprone-use-after-move) EXPECT_DEATH_IF_SUPPORTED(t1.size(), "moved-from"); - // NOLINTNEXTLINE(bugprone-use-after-move) - EXPECT_DEATH_IF_SUPPORTED(IntTable{std::move(t1)}, "moved-from"); } { ABSL_ATTRIBUTE_UNUSED IntTable t1;