]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/common: disable tests for commutativity of operator==()
authorKefu Chai <tchaikov@gmail.com>
Sat, 30 Jul 2022 04:27:37 +0000 (12:27 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sat, 30 Jul 2022 06:41:05 +0000 (14:41 +0800)
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 <tchaikov@gmail.com>
src/test/common/test_static_ptr.cc

index f1c07c81b45fa12710911aa73f007dda8f7bcecb..0a4073e758cfc1ae65d64f7db51c5aad83703b1a 100644 (file)
@@ -12,8 +12,9 @@
  *
  */
 
-#include "common/static_ptr.h"
+#include <compare>
 #include <gtest/gtest.h>
+#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<base, sizeof(grandchild)> 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<base, sizeof(grandchild)> p(std::in_place_type_t<sibling1>{});