Commits


Weston Pace authored and GitHub committed 79563cf2f79
GH-15098: [C++] fix util::EqualityComparable to compile on clang 15 (#33940) If you have an equality operator then C++20 then clang 15 expects it to be symmetric. The util::EqualityComparable operator== was defined as: `bool operator==(util::EqualityComparable<T>, T)` and there is no equivalent: `bool operator==(T, util::EqualityComparable<T>)` This was later determined to be unintentional strictness and the [standard was clarified](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2468r2.html). This error was relaxed in clang 16. Equality only needs to be symmetric if you want the compiler to provide `!=` for you (which we don't rely on). However, it seems like a worthwhile fix, and it doesn't appear that Clang will be backporting the fix to clang 15 (that is my interpretation of the fact that clang lists the defect as clang-16 in this conformance page: https://clang.llvm.org/cxx_status.html). Furthermore, the old definition allowed for `Scalar::operator==(std::shared_ptr<Scalar> other)` (i.e. comparing with a shared_ptr) and it isn't clear to me that should be allowed (it's generally inconsistent with the rest of the code base). This change seems to have undone that and I made no change to restore it (and instead fixed the references to that odd equality operation). BREAKING CHANGE: The functions `bool Scalar::Equals(const std::shared_ptr<Scalar>&) const` and `bool Scalar::Equals(const std::shared_ptr<Scalar>&, const EqualOptions&) const` have been removed. Instead `bool Scalar::Equals(const Scalar&) const` and `bool Scalar::Equals(const Scalar&, const EqualOptions&) const` should be used. BREAKING CHANGE: `FileInfo::ToString` now includes the size and mtime. * Closes: #15098 Authored-by: Weston Pace <weston.pace@gmail.com> Signed-off-by: Weston Pace <weston.pace@gmail.com>