[libcxx-commits] [libcxx] [libc++][hardening] Categorize more assertions. (PR #75918)

Konstantin Varlamov via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 3 14:56:19 PST 2024


================
@@ -36,7 +36,8 @@ __pop_heap(_RandomAccessIterator __first,
            _RandomAccessIterator __last,
            _Compare& __comp,
            typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
-  _LIBCPP_ASSERT_UNCATEGORIZED(__len > 0, "The heap given to pop_heap must be non-empty");
+  // Calling `pop_heap` on an empty range is undefined behavior, but in practice it will be a no-op.
----------------
var-const wrote:

I like the idea, but would prefer to do this in a separate PR and merge after the next release is branched.

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


More information about the libcxx-commits mailing list