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

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 5 05:52:11 PDT 2026


https://github.com/eiytoq updated https://github.com/llvm/llvm-project/pull/201061

>From b562e3d9e1032a716ef359f6689e56d7c7883177 Mon Sep 17 00:00:00 2001
From: eiytoq <eiytoq at outlook.com>
Date: Tue, 2 Jun 2026 16:39:24 +0800
Subject: [PATCH] fix

---
 .../views/mdspan/layout_left/index_operator.pass.cpp          | 4 ++--
 .../views/mdspan/layout_right/index_operator.pass.cpp         | 4 ++--
 .../views/mdspan/layout_stride/index_operator.pass.cpp        | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

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