[libcxx-commits] [libcxx] [libc++][test] Merge test files for `mdspan::at` (PR #199330)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sat May 23 01:53:47 PDT 2026


================
@@ -312,6 +313,77 @@ static void test_throws() {
 
   [[maybe_unused]] std::array bad_col{0, 10};
   TEST_THROWS_TYPE(std::out_of_range, m.at(std::span{bad_col}));
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+  auto verify_exception_message = [](auto&& f) {
+    try {
+      f();
+      assert(false && "Unexpected");
+    } catch (const std::out_of_range& e [[maybe_unused]]) {
+      LIBCPP_ASSERT(std::string_view(e.what()) == "mdspan");
----------------
frederick-vs-ja wrote:

I think this is fine as the exception message must exist. `LIBCPP_ASSERT` is sometimes used in tests in `libcxx/test/std/` subdirectory for libc++-specific behavior.

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


More information about the libcxx-commits mailing list