From: Kefu Chai Date: Sat, 30 Jul 2022 04:27:37 +0000 (+0800) Subject: test/common: disable tests for commutativity of operator==() X-Git-Tag: v18.0.0~366^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cfcab5a9ddff0d44766c80b117b9f6ad00ebc626;p=ceph.git test/common: disable tests for commutativity of operator==() older C++ compiler like GCC-9 does not rewrite operator==() so that `a == b` implies `b == a`, in other words: operator==(const LHS& lhs, const RHS& rhs) is equivalent to operator==(const RHS& rhs, const LHS& lhs). see section 1.2 in https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0515r3.pdf Signed-off-by: Kefu Chai --- diff --git a/src/test/common/test_static_ptr.cc b/src/test/common/test_static_ptr.cc index f1c07c81b45f..0a4073e758cf 100644 --- a/src/test/common/test_static_ptr.cc +++ b/src/test/common/test_static_ptr.cc @@ -12,8 +12,9 @@ * */ -#include "common/static_ptr.h" +#include #include +#include "common/static_ptr.h" using ceph::static_ptr; using ceph::make_static; @@ -49,6 +50,7 @@ public: int call(int n) override { return n + val; } }; +#ifdef __cpp_lib_three_way_comparison TEST(StaticPtr, EmptyCreation) { static_ptr p; EXPECT_FALSE(p); @@ -100,6 +102,7 @@ TEST(StaticPtr, CreateReset) { EXPECT_TRUE(p.get() == nullptr); } } +#endif // __cpp_lib_three_way_comparison TEST(StaticPtr, CreateEmplace) { static_ptr p(std::in_place_type_t{});