[libcxx-commits] [libcxx] [libc++] Add missing assertion in std::span constructor (PR #118396)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 6 13:18:21 PST 2024


================
@@ -25,13 +25,48 @@
 #include "check_assertion.h"
 
 int main(int, char**) {
-    std::array<int, 3> array{0, 1, 2};
+  std::array<int, 3> array{0, 1, 2};
 
-    auto too_large = [&] { std::span<int, 3> const s(array.data(), 4); (void)s; };
-    TEST_LIBCPP_ASSERT_FAILURE(too_large(), "size mismatch in span's constructor (iterator, len)");
+  // Providing too large value in constructor
----------------
ldionne wrote:

That's so much better than what I had! Applying.

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


More information about the libcxx-commits mailing list