From 3d119c82792592f924ba0f896027f361067b859a Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 3 Mar 2022 15:30:59 +0800 Subject: [PATCH] common/static_ptr: drop ambiguous operator==() because in C++20, comparison operator is considered reversed also. so drop the reversed operators. otherwise we'd have following FTBFS: ../src/test/common/test_static_ptr.cc:64:20: error: use of overloaded operator '==' is ambiguous (with operand types 'static_ptr' and 'nullptr_t') EXPECT_FALSE(p == nullptr); ~ ^ ~~~~~~~ ../src/googletest/googletest/include/gtest/gtest.h:1984:25: note: expanded from macro 'EXPECT_FALSE' GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ ^~~~~~~~~ Signed-off-by: Kefu Chai --- src/common/static_ptr.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/common/static_ptr.h b/src/common/static_ptr.h index 542f1e9a67a42..2091c6cf4d609 100644 --- a/src/common/static_ptr.h +++ b/src/common/static_ptr.h @@ -330,17 +330,9 @@ bool operator ==(const static_ptr& s, std::nullptr_t) { return !s; } template -bool operator ==(std::nullptr_t, const static_ptr& s) { - return !s; -} -template bool operator ==(static_ptr& s, std::nullptr_t) { return !s; } -template -bool operator ==(std::nullptr_t, static_ptr& s) { - return !s; -} // Since `make_unique` and `make_shared` exist, we should follow their // lead. -- 2.39.5