From cfcab5a9ddff0d44766c80b117b9f6ad00ebc626 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 30 Jul 2022 12:27:37 +0800 Subject: [PATCH] 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 --- src/test/common/test_static_ptr.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/common/test_static_ptr.cc b/src/test/common/test_static_ptr.cc index f1c07c81b45fa..0a4073e758cfc 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{}); -- 2.39.5