[libcxx-commits] [libcxx] [libc++] Add input validation for set_intersection() in debug mode. (PR #101508)
Alexander Kornienko via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Aug 2 05:48:11 PDT 2024
================
@@ -43,33 +43,32 @@
#include "test_iterators.h"
-namespace {
-
-// __debug_less will perform an additional comparison in an assertion
-static constexpr unsigned std_less_comparison_count_multiplier() noexcept {
-#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
- return 2;
+// debug mode provides no complexity guarantees, testing them would be a waste of effort
+// but we still want to run this test, to ensure we don't trigger any assertions
+#ifdef _LIBCPP_HARDENING_MODE_DEBUG
+# define ASSERT_COMPLEXITY(expression)
----------------
alexfh wrote:
Maybe `(void)(expression)`, `assert(expression || true)` or something like this to ensure it compiles in debug mode?
https://github.com/llvm/llvm-project/pull/101508
More information about the libcxx-commits
mailing list