[libcxx-commits] [PATCH] D94511: [libc++] [C++20] [P0586] Implement safe integral comparisons

Marek Kurdej via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 7 11:00:33 PDT 2021


curdeius added a comment.

I'd like to see some "manual" tests like:

- max(uint64_t) vs. min(int64_t) (both represented as 0xFF'FF'FF'FF unless I'm mistaken)

And other cases for the different non-trivial conditions of cmp_equal/cmp_less.
Please correct me if they're already present.



================
Comment at: libcxx/include/utility:325
+{
+  using T1U = make_unsigned_t<_Tp>;
+  using T2U = make_unsigned_t<_Up>;
----------------
Please _Uglify the names.


================
Comment at: libcxx/test/std/utilities/utility/utility.intcmp/intcmp.fail.cpp:52
+  std:: // expected-error11{{no matching function for call to 'cmp_less'}}
+      cmp_less(int(), T());
+  std:: // expected-error11{{no matching function for call to 'in_range'}}
----------------
Please be exhaustive and test less_equal, greater_equal, not_equal too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94511



More information about the libcxx-commits mailing list