[flang-commits] [flang] [llvm] [libc] [lldb] [clang] [compiler-rt] [libunwind] [libcxx] [clang-tools-extra] [libc++] Implement ranges::iota (PR #68494)

James E T Smith via flang-commits flang-commits at lists.llvm.org
Mon Jan 15 18:09:09 PST 2024


================
@@ -1149,9 +1171,11 @@ struct Proxy {
   // Calling swap(Proxy<T>{}, Proxy<T>{}) would fail (pass prvalues)
 
   // Compare operators are defined for the convenience of the tests
-  friend constexpr bool operator==(const Proxy&, const Proxy&)
-    requires (std::equality_comparable<T> && !std::is_reference_v<T>)
-  = default;
+  friend constexpr bool operator==(const Proxy& lhs, const Proxy& rhs)
+    requires(std::equality_comparable<T> && !std::is_reference_v<T>)
+  {
+    return lhs.data == rhs.data;
+  };
----------------
jamesETsmith wrote:

Thanks to an offline discussion with @Quuxplusone, I now know that these operators only started causing problems when I introduced the base class `ProxyDiffTBase` because the base subobject wasn't trivially comparable. Since the `operator==` for `Proxy` is used all over, when they stopped functioning properly a lot of tests started failing which is what prompted me to make those changes to begin with. At @Quuxplusone's suggestion, I've specified the comparison operators for the base class (and derived `Proxy` class) as default, undoing the changes we were talking about here and below.

https://github.com/llvm/llvm-project/pull/68494


More information about the flang-commits mailing list