[libcxx-commits] [PATCH] D154425: [libc++] add basic runtime assertions to <latch>

Edo via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 4 12:35:37 PDT 2023


diamante0018 added inline comments.


================
Comment at: libcxx/include/latch:80-81
+    {
+        _LIBCPP_ASSERT_UNCATEGORIZED(__expected >= 0,
+                                     "__expected cannot be negative");
+    }
----------------
ldionne wrote:
> I think it is also UB if `__expected > max()`, right? If so, let's add an assertion.
You are right but in this implementation because max is equivalent to std::numeric_limits<ptrdiff_t>::max() it should not be possible


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

https://reviews.llvm.org/D154425



More information about the libcxx-commits mailing list