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>
*
*/
-#include "common/static_ptr.h"
+#include <compare>
#include <gtest/gtest.h>
+#include "common/static_ptr.h"
using ceph::static_ptr;
using ceph::make_static;
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);
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>{});