Commit 2d4c6872 by Abseil Team Committed by Copybara-Service

std::shared_ptr<T>::unique() is deprecated in C++17 and removed in C++20.

Change to checking for use_count() >/== 1.

PiperOrigin-RevId: 510125744
Change-Id: I572cca18c3f827f5d3eefb2ec19a1a014c0090ae
parent b5404457
...@@ -1431,14 +1431,14 @@ TYPED_TEST_P(AnyInvTestRvalue, QualifierIndependentObjectLifetime) { ...@@ -1431,14 +1431,14 @@ TYPED_TEST_P(AnyInvTestRvalue, QualifierIndependentObjectLifetime) {
auto refs = std::make_shared<std::nullptr_t>(); auto refs = std::make_shared<std::nullptr_t>();
{ {
AnyInvType fun([refs](auto&&...) noexcept { return 0; }); AnyInvType fun([refs](auto&&...) noexcept { return 0; });
EXPECT_FALSE(refs.unique()); EXPECT_GT(refs.use_count(), 1);
std::move(fun)(7, 8, 9); std::move(fun)(7, 8, 9);
// Ensure destructor hasn't run even if rref-qualified // Ensure destructor hasn't run even if rref-qualified
EXPECT_FALSE(refs.unique()); EXPECT_GT(refs.use_count(), 1);
} }
EXPECT_TRUE(refs.unique()); EXPECT_EQ(refs.use_count(), 1);
} }
// NOTE: This test suite originally attempted to enumerate all possible // NOTE: This test suite originally attempted to enumerate all possible
......
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