[libcxx-commits] [PATCH] D150081: [libc++] Make a few standard types trivially equality comparable

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 23 10:20:08 PDT 2023


ldionne added inline comments.


================
Comment at: libcxx/include/array:266
+    // conforming extension: This is not observable other than through SFINAE on `u.operator==`
+    // This makes pair trivially equality comparable if _Tp is trivially equality comparable
+    _LIBCPP_HIDE_FROM_ABI bool operator==(const array&) const = default;
----------------



================
Comment at: libcxx/include/tuple:1362
+public:
+    bool operator==(const tuple&) const = default;
+#endif
----------------
Conforming extension comment?


================
Comment at: libcxx/test/libcxx/types_are_trivially_equality_comparable.compile.pass.cpp:38
+static_assert(is_tec<std::list<int>::const_iterator>);
+// These are currently false because of a compiler bug
+// static_assert(is_tec<std::pair<int, int>>);
----------------
Per your comment, you might be able to uncomment this now.


================
Comment at: libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp:17
 
 // UNSUPPORTED: c++03
 
----------------
About your CI issues, I think this might be a compiler bug:

Works with all compilers: https://godbolt.org/z/Pc8bqczvo
Works with GCC but not Clang/MSVC: https://godbolt.org/z/j68j4Ezcn

I think they should both work on all compilers.

Edit: The problem seems to be that Clang and MSVC will instantiate `operator==` a bit too eagerly: https://godbolt.org/z/5hMKWzoMs, which triggers ADL on `Holder<Incomplete>`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150081/new/

https://reviews.llvm.org/D150081



More information about the libcxx-commits mailing list