[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 10:31:24 PDT 2021
curdeius added inline comments.
================
Comment at: libcxx/include/utility:332
+ else
+ return __t < 0 ? false : __t == T2U(__u);
+}
----------------
This doesn't make sense.`_Tp` is unsigned here. You should have swapped t and u.
Cf. the example implementation https://raw.githubusercontent.com/fekir/safeintegral/master/safeintegral/safeintegralop_cmp.hpp.
But first, you need to add a regression test for this.
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