[libcxx-commits] [libcxx] 068220a - [libc++][mdspan][test] Correct `mapping::operator()` constraint tests (#201061)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 18 06:52:58 PDT 2026


Author: eiytoq
Date: 2026-06-18T09:52:54-04:00
New Revision: 068220af2388737552e70a6cf7cae4b709bd4eb9

URL: https://github.com/llvm/llvm-project/commit/068220af2388737552e70a6cf7cae4b709bd4eb9
DIFF: https://github.com/llvm/llvm-project/commit/068220af2388737552e70a6cf7cae4b709bd4eb9.diff

LOG: [libc++][mdspan][test] Correct `mapping::operator()` constraint tests (#201061)

The previous requires-expression only checked that `std::is_same_v<...>`
was a well-formed expression, so the test would pass even when the
result was false.

Added: 
    

Modified: 
    libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
    libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
    libcxx/test/std/containers/views/mdspan/layout_stride/index_operator.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
index 55d9539d8c63f..3868c8ca7a48a 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
@@ -27,7 +27,7 @@
 #include <cstddef>
 #include <cstdint>
 #include <mdspan>
-#include <type_traits>
+#include <concepts>
 
 #include "test_macros.h"
 
@@ -35,7 +35,7 @@
 
 template <class Mapping, class... Indices>
 concept operator_constraints = requires(Mapping m, Indices... idxs) {
-  { std::is_same_v<decltype(m(idxs...)), typename Mapping::index_type> };
+  { m(idxs...) } noexcept -> std::same_as<typename Mapping::index_type>;
 };
 
 template <class Mapping, class... Indices>

diff  --git a/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
index 4623af7fb5b76..192d457bc77d6 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
@@ -27,7 +27,7 @@
 #include <cstddef>
 #include <cstdint>
 #include <mdspan>
-#include <type_traits>
+#include <concepts>
 
 #include "test_macros.h"
 
@@ -35,7 +35,7 @@
 
 template <class Mapping, class... Indices>
 concept operator_constraints = requires(Mapping m, Indices... idxs) {
-  { std::is_same_v<decltype(m(idxs...)), typename Mapping::index_type> };
+  { m(idxs...) } noexcept -> std::same_as<typename Mapping::index_type>;
 };
 
 template <class Mapping, class... Indices>

diff  --git a/libcxx/test/std/containers/views/mdspan/layout_stride/index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/index_operator.pass.cpp
index b483885049a7b..9f6ce5cbde4a7 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/index_operator.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/index_operator.pass.cpp
@@ -27,7 +27,7 @@
 #include <array>
 #include <cassert>
 #include <cstdint>
-#include <type_traits>
+#include <concepts>
 
 #include "test_macros.h"
 
@@ -35,7 +35,7 @@
 
 template <class Mapping, class... Indices>
 concept operator_constraints = requires(Mapping m, Indices... idxs) {
-  { std::is_same_v<decltype(m(idxs...)), typename Mapping::index_type> };
+  { m(idxs...) } noexcept -> std::same_as<typename Mapping::index_type>;
 };
 
 template <class Mapping, class... Indices>


        


More information about the libcxx-commits mailing list