This is specified as const in the standard.

libstdc++-v3/ChangeLog:

        * include/std/mdspan (mdspan::is_exhaustive): Add const keyword.
        * testsuite/23_containers/mdspan/mdspan.cc: Check that
        is_unique, is_exhaustive, and is_strided can be called on a
        const object.
---

Tested x86_64-linux.

 libstdc++-v3/include/std/mdspan                       | 2 +-
 libstdc++-v3/testsuite/23_containers/mdspan/mdspan.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan
index 5938bf09a940..27d15df12944 100644
--- a/libstdc++-v3/include/std/mdspan
+++ b/libstdc++-v3/include/std/mdspan
@@ -2621,7 +2621,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        { return _PaddedStorage::_M_is_always_exhaustive(); }
 
        constexpr bool
-       is_exhaustive() noexcept
+       is_exhaustive() const noexcept
        { return _M_storage._M_is_exhaustive(); }
 
        static constexpr bool
diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/mdspan.cc 
b/libstdc++-v3/testsuite/23_containers/mdspan/mdspan.cc
index 62ff7201cce9..99205142579a 100644
--- a/libstdc++-v3/testsuite/23_containers/mdspan/mdspan.cc
+++ b/libstdc++-v3/testsuite/23_containers/mdspan/mdspan.cc
@@ -715,7 +715,7 @@ template<typename Layout, bool Expected>
   test_nothrow_is_methods()
   {
     using Extents = std::extents<int, dyn>;
-    using MDSpan = std::mdspan<double, Extents, Layout>;
+    using MDSpan = const std::mdspan<double, Extents, Layout>;
     static_assert(noexcept(MDSpan::is_always_unique()) == Expected);
     static_assert(noexcept(MDSpan::is_always_exhaustive()) == Expected);
     static_assert(noexcept(MDSpan::is_always_strided()) == Expected);
-- 
2.54.0

Reply via email to