diff --git a/include/experimental/__p0009_bits/compressed_pair.hpp b/include/experimental/__p0009_bits/compressed_pair.hpp index 541e5787..25389a2f 100644 --- a/include/experimental/__p0009_bits/compressed_pair.hpp +++ b/include/experimental/__p0009_bits/compressed_pair.hpp @@ -28,8 +28,8 @@ namespace detail { // For no unique address emulation, this is the case taken when neither are empty. // For real `[[no_unique_address]]`, this case is always taken. template struct __compressed_pair { - _MDSPAN_NO_UNIQUE_ADDRESS _T1 __t1_val; - _MDSPAN_NO_UNIQUE_ADDRESS _T2 __t2_val; + _MDSPAN_NO_UNIQUE_ADDRESS _T1 __t1_val{}; + _MDSPAN_NO_UNIQUE_ADDRESS _T2 __t2_val{}; MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T1 &__first() noexcept { return __t1_val; } MDSPAN_FORCE_INLINE_FUNCTION constexpr _T1 const &__first() const noexcept { return __t1_val; @@ -40,19 +40,19 @@ template struct __compressed_pair { } MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair() noexcept = default; + constexpr __compressed_pair() = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair(__compressed_pair const &) noexcept = default; + constexpr __compressed_pair(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair(__compressed_pair &&) noexcept = default; + constexpr __compressed_pair(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & - operator=(__compressed_pair const &) noexcept = default; + operator=(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & - operator=(__compressed_pair &&) noexcept = default; + operator=(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - ~__compressed_pair() noexcept = default; + ~__compressed_pair() = default; template MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_T1Like &&__t1, _T2Like &&__t2) : __t1_val((_T1Like &&) __t1), __t2_val((_T2Like &&) __t2) {} @@ -66,7 +66,7 @@ struct __compressed_pair< _T1, _T2, std::enable_if_t<_MDSPAN_TRAIT(std::is_empty, _T1) && !_MDSPAN_TRAIT(std::is_empty, _T2)>> : private _T1 { - _T2 __t2_val; + _T2 __t2_val{}; MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T1 &__first() noexcept { return *static_cast<_T1 *>(this); } @@ -79,19 +79,19 @@ struct __compressed_pair< } MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair() noexcept = default; + constexpr __compressed_pair() = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair(__compressed_pair const &) noexcept = default; + constexpr __compressed_pair(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair(__compressed_pair &&) noexcept = default; + constexpr __compressed_pair(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & - operator=(__compressed_pair const &) noexcept = default; + operator=(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & - operator=(__compressed_pair &&) noexcept = default; + operator=(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - ~__compressed_pair() noexcept = default; + ~__compressed_pair() = default; template MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_T1Like &&__t1, _T2Like &&__t2) : _T1((_T1Like &&) __t1), __t2_val((_T2Like &&) __t2) {} @@ -103,7 +103,7 @@ struct __compressed_pair< _T1, _T2, std::enable_if_t> : private _T2 { - _T1 __t1_val; + _T1 __t1_val{}; MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T1 &__first() noexcept { return __t1_val; } MDSPAN_FORCE_INLINE_FUNCTION constexpr _T1 const &__first() const noexcept { return __t1_val; @@ -116,19 +116,19 @@ struct __compressed_pair< } MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair() noexcept = default; + constexpr __compressed_pair() = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair(__compressed_pair const &) noexcept = default; + constexpr __compressed_pair(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair(__compressed_pair &&) noexcept = default; + constexpr __compressed_pair(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & - operator=(__compressed_pair const &) noexcept = default; + operator=(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & - operator=(__compressed_pair &&) noexcept = default; + operator=(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - ~__compressed_pair() noexcept = default; + ~__compressed_pair() = default; template MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_T1Like &&__t1, _T2Like &&__t2) @@ -169,19 +169,19 @@ struct __compressed_pair< } MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair() noexcept = default; + constexpr __compressed_pair() = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair(__compressed_pair const &) noexcept = default; + constexpr __compressed_pair(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - constexpr __compressed_pair(__compressed_pair &&) noexcept = default; + constexpr __compressed_pair(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & - operator=(__compressed_pair const &) noexcept = default; + operator=(__compressed_pair const &) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & - operator=(__compressed_pair &&) noexcept = default; + operator=(__compressed_pair &&) = default; MDSPAN_INLINE_FUNCTION_DEFAULTED - ~__compressed_pair() noexcept = default; + ~__compressed_pair() = default; template MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_T1Like &&__t1, _T2Like &&__t2) noexcept : __first_base_t(_T1((_T1Like &&) __t1)), diff --git a/include/experimental/__p0009_bits/mdspan.hpp b/include/experimental/__p0009_bits/mdspan.hpp index cb593ca7..e976ab87 100644 --- a/include/experimental/__p0009_bits/mdspan.hpp +++ b/include/experimental/__p0009_bits/mdspan.hpp @@ -55,6 +55,13 @@ class mdspan ReferenceType __callop(mdspan const& __self, const std::array& indices) noexcept { return __self.__accessor_ref().access(__self.__ptr_ref(), __self.__mapping_ref()(indices[Idxs]...)); } +#ifdef __cpp_lib_span + template + MDSPAN_FORCE_INLINE_FUNCTION static constexpr + ReferenceType __callop(mdspan const& __self, const std::span& indices) noexcept { + return __self.__accessor_ref().access(__self.__ptr_ref(), __self.__mapping_ref()(indices[Idxs]...)); + } +#endif }; public: @@ -183,6 +190,10 @@ class mdspan _MDSPAN_TRAIT(std::is_constructible, accessor_type, const OtherAccessor&) ) ) + MDSPAN_CONDITIONAL_EXPLICIT( + !_MDSPAN_TRAIT(std::is_convertible, const typename OtherLayoutPolicy::template mapping&, mapping_type) || + !_MDSPAN_TRAIT(std::is_convertible, const OtherAccessor&, accessor_type) + ) MDSPAN_INLINE_FUNCTION constexpr mdspan(const mdspan& other) : __members(other.__ptr_ref(), __map_acc_pair_t(other.__mapping_ref(), other.__accessor_ref())) @@ -226,8 +237,8 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class SizeType, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, SizeType, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, SizeType) + _MDSPAN_TRAIT(std::is_convertible, const SizeType&, index_type) && + _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) ) ) MDSPAN_FORCE_INLINE_FUNCTION @@ -240,8 +251,8 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class SizeType, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, SizeType, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, SizeType) + _MDSPAN_TRAIT(std::is_convertible, const SizeType&, index_type) && + _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) ) ) MDSPAN_FORCE_INLINE_FUNCTION @@ -285,8 +296,8 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class SizeType, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, SizeType, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, SizeType) + _MDSPAN_TRAIT(std::is_convertible, const SizeType&, index_type) && + _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) ) ) MDSPAN_FORCE_INLINE_FUNCTION @@ -299,8 +310,8 @@ class mdspan MDSPAN_TEMPLATE_REQUIRES( class SizeType, /* requires */ ( - _MDSPAN_TRAIT(std::is_convertible, SizeType, index_type) && - _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, SizeType) + _MDSPAN_TRAIT(std::is_convertible, const SizeType&, index_type) && + _MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, const SizeType&) ) ) MDSPAN_FORCE_INLINE_FUNCTION @@ -311,7 +322,7 @@ class mdspan #endif // __cpp_lib_span #endif // MDSPAN_USE_PAREN_OPERATOR - MDSPAN_INLINE_FUNCTION constexpr size_t size() const noexcept { + MDSPAN_INLINE_FUNCTION constexpr size_type size() const noexcept { return __impl::__size(*this); }; @@ -346,13 +357,13 @@ class mdspan //-------------------------------------------------------------------------------- // [mdspan.basic.obs], mdspan observers of the mapping - MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return mapping_type::is_always_unique(); }; - MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() noexcept { return mapping_type::is_always_exhaustive(); }; - MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() noexcept { return mapping_type::is_always_strided(); }; + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() { return mapping_type::is_always_unique(); }; + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() { return mapping_type::is_always_exhaustive(); }; + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() { return mapping_type::is_always_strided(); }; - MDSPAN_INLINE_FUNCTION constexpr bool is_unique() const noexcept { return __mapping_ref().is_unique(); }; - MDSPAN_INLINE_FUNCTION constexpr bool is_exhaustive() const noexcept { return __mapping_ref().is_exhaustive(); }; - MDSPAN_INLINE_FUNCTION constexpr bool is_strided() const noexcept { return __mapping_ref().is_strided(); }; + MDSPAN_INLINE_FUNCTION constexpr bool is_unique() const { return __mapping_ref().is_unique(); }; + MDSPAN_INLINE_FUNCTION constexpr bool is_exhaustive() const { return __mapping_ref().is_exhaustive(); }; + MDSPAN_INLINE_FUNCTION constexpr bool is_strided() const { return __mapping_ref().is_strided(); }; MDSPAN_INLINE_FUNCTION constexpr index_type stride(size_t r) const { return __mapping_ref().stride(r); }; private: @@ -374,7 +385,7 @@ class mdspan #if defined(_MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION) MDSPAN_TEMPLATE_REQUIRES( class ElementType, class... SizeTypes, - /* requires */ _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(std::is_integral, SizeTypes) /* && ... */) && + /* requires */ _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(std::is_convertible, SizeTypes, size_t) /* && ... */) && (sizeof...(SizeTypes) > 0) ) MDSPAN_DEDUCTION_GUIDE explicit mdspan(ElementType*, SizeTypes...) diff --git a/include/experimental/__p1684_bits/mdarray.hpp b/include/experimental/__p1684_bits/mdarray.hpp index 3950273a..5915b26e 100644 --- a/include/experimental/__p1684_bits/mdarray.hpp +++ b/include/experimental/__p1684_bits/mdarray.hpp @@ -433,8 +433,9 @@ class mdarray { class OtherElementType, class OtherExtents, class OtherLayoutType, class OtherAccessorType, /* requires */ ( - _MDSPAN_TRAIT(std::is_assignable, mdspan_type, - mdspan) + _MDSPAN_TRAIT(std::is_assignable, + mdspan, + mdspan_type) ) ) constexpr operator mdspan () { @@ -445,8 +446,9 @@ class mdarray { class OtherElementType, class OtherExtents, class OtherLayoutType, class OtherAccessorType, /* requires */ ( - _MDSPAN_TRAIT(std::is_assignable, const_mdspan_type, - mdspan) + _MDSPAN_TRAIT(std::is_assignable, + mdspan, + const_mdspan_type) ) ) constexpr operator mdspan () const { diff --git a/tests/libcxx-backports/CustomTestLayouts.h b/tests/libcxx-backports/CustomTestLayouts.h index 5ce8d35d..c1973e3b 100644 --- a/tests/libcxx-backports/CustomTestLayouts.h +++ b/tests/libcxx-backports/CustomTestLayouts.h @@ -177,6 +177,7 @@ class layout_wrapping_integral::mapping { #if MDSPAN_HAS_CXX_23 friend constexpr void swap(mapping& x, mapping& y) noexcept { + using std::swap; swap(x.extents_, y.extents_); if !consteval { swap_counter()++; diff --git a/tests/libcxx-backports/mdspan/CMakeLists.txt b/tests/libcxx-backports/mdspan/CMakeLists.txt index 48f3e1c0..04ba79f6 100644 --- a/tests/libcxx-backports/mdspan/CMakeLists.txt +++ b/tests/libcxx-backports/mdspan/CMakeLists.txt @@ -1,5 +1,5 @@ mdspan_add_test(mdspan.assign.pass) -#mdspan_add_test(mdspan.conversion.pass) //FIXME +mdspan_add_test(mdspan.conversion.pass) #mdspan_add_test(mdspan.conversion.verify) mdspan_add_test(mdspan.ctor.copy.pass) mdspan_add_test(mdspan.ctor.default.pass) @@ -13,9 +13,9 @@ mdspan_add_test(mdspan.ctor.move.pass) mdspan_add_test(mdspan.deduction.pass) #mdspan_add_test(mdspan.element_type.verify) #mdspan_add_test(mdspan.extents.verify) -#mdspan_add_test(mdspan.index_operator.pass) //FIXME +mdspan_add_test(mdspan.index_operator.pass) #mdspan_add_test(mdspan.mapping.verify) mdspan_add_test(mdspan.move.pass) mdspan_add_test(mdspan.properties.pass) -#mdspan_add_test(mdspan.swap.pass) //FIXME +mdspan_add_test(mdspan.swap.pass) mdspan_add_test(mdspan.types.pass) diff --git a/tests/libcxx-backports/mdspan/mdspan.ctor.copy.pass.cpp b/tests/libcxx-backports/mdspan/mdspan.ctor.copy.pass.cpp index f5f8586d..7b8e498f 100644 --- a/tests/libcxx-backports/mdspan/mdspan.ctor.copy.pass.cpp +++ b/tests/libcxx-backports/mdspan/mdspan.ctor.copy.pass.cpp @@ -30,7 +30,7 @@ constexpr void test_mdspan_types(const H& handle, const M& map, const A& acc) { MDS m_org(handle, map, acc); MDS m(m_org); - //static_assert(noexcept(MDS(m_org)) == (noexcept(H(handle))&& noexcept(M(map))&& noexcept(A(acc)))); //FIXME + static_assert(noexcept(MDS(m_org)) == (noexcept(H(handle))&& noexcept(M(map))&& noexcept(A(acc)))); static_assert( std::is_trivially_copyable_v == (std::is_trivially_copyable_v && std::is_trivially_copyable_v && std::is_trivially_copyable_v)); diff --git a/tests/libcxx-backports/mdspan/mdspan.ctor.default.pass.cpp b/tests/libcxx-backports/mdspan/mdspan.ctor.default.pass.cpp index 6e859fb4..41ebfdab 100644 --- a/tests/libcxx-backports/mdspan/mdspan.ctor.default.pass.cpp +++ b/tests/libcxx-backports/mdspan/mdspan.ctor.default.pass.cpp @@ -42,7 +42,7 @@ constexpr void test_mdspan_types(const H&, const M&, const A&) { if constexpr (MDS::rank_dynamic() > 0 && hc && mc && ac) { MDS m; - //static_assert(noexcept(MDS()) == (noexcept(H())&& noexcept(M())&& noexcept(A()))); //FIXME + static_assert(noexcept(MDS()) == (noexcept(H())&& noexcept(M())&& noexcept(A()))); assert(m.extents() == typename MDS::extents_type()); if constexpr (std::equality_comparable) assert(m.data_handle() == H()); @@ -106,6 +106,6 @@ constexpr bool test() { } int main(int, char**) { test(); - // static_assert(test()); //FIXME + static_assert(test()); return 0; } diff --git a/tests/libcxx-backports/mdspan/mdspan.ctor.dh_extents.pass.cpp b/tests/libcxx-backports/mdspan/mdspan.ctor.dh_extents.pass.cpp index c52891d3..2a7aac22 100644 --- a/tests/libcxx-backports/mdspan/mdspan.ctor.dh_extents.pass.cpp +++ b/tests/libcxx-backports/mdspan/mdspan.ctor.dh_extents.pass.cpp @@ -64,7 +64,7 @@ constexpr void test_mdspan_types(const H& handle, const M& map, const A&) { if constexpr (std::equality_comparable) assert(m.accessor() == A()); } else { - //static_assert(!std::is_constructible_v); //FIXME + static_assert(!std::is_constructible_v); } } diff --git a/tests/libcxx-backports/mdspan/mdspan.ctor.dh_span.pass.cpp b/tests/libcxx-backports/mdspan/mdspan.ctor.dh_span.pass.cpp index 3d80d8ea..1de91a11 100644 --- a/tests/libcxx-backports/mdspan/mdspan.ctor.dh_span.pass.cpp +++ b/tests/libcxx-backports/mdspan/mdspan.ctor.dh_span.pass.cpp @@ -108,9 +108,9 @@ constexpr void test_mdspan_ctor(const H& handle, const M& map, const A& acc) { template constexpr void mixin_extents(const H& handle, const L& layout, const A& acc) { constexpr size_t D = std::dynamic_extent; - //test_mdspan_ctor(handle, construct_mapping(layout, std::extents()), acc); //FIXME + test_mdspan_ctor(handle, construct_mapping(layout, std::extents()), acc); test_mdspan_ctor(handle, construct_mapping(layout, std::extents(7)), acc); - //test_mdspan_ctor(handle, construct_mapping(layout, std::extents()), acc); //FIXME + test_mdspan_ctor(handle, construct_mapping(layout, std::extents()), acc); test_mdspan_ctor(handle, construct_mapping(layout, std::extents(2, 3)), acc); test_mdspan_ctor(handle, construct_mapping(layout, std::extents(0, 3)), acc); test_mdspan_ctor( diff --git a/tests/libcxx-backports/mdspan/mdspan.deduction.pass.cpp b/tests/libcxx-backports/mdspan/mdspan.deduction.pass.cpp index 208412b0..1f2362e2 100644 --- a/tests/libcxx-backports/mdspan/mdspan.deduction.pass.cpp +++ b/tests/libcxx-backports/mdspan/mdspan.deduction.pass.cpp @@ -100,7 +100,7 @@ constexpr bool test_no_layout_deduction_guides(const H& handle, const A&) { // deduction from pointer alone ASSERT_SAME_TYPE(decltype(std::mdspan(handle)), std::mdspan>); // deduction from pointer and integral like - //ASSERT_SAME_TYPE(decltype(std::mdspan(handle, 5, SizeTIntType(6))), std::mdspan>); //FIXME + ASSERT_SAME_TYPE(decltype(std::mdspan(handle, 5, SizeTIntType(6))), std::mdspan>); std::array exts; // deduction from pointer and array diff --git a/tests/libcxx-backports/mdspan/mdspan.index_operator.pass.cpp b/tests/libcxx-backports/mdspan/mdspan.index_operator.pass.cpp index 8a6dcedb..5cca1d80 100644 --- a/tests/libcxx-backports/mdspan/mdspan.index_operator.pass.cpp +++ b/tests/libcxx-backports/mdspan/mdspan.index_operator.pass.cpp @@ -38,6 +38,9 @@ #include "../ConvertibleToIntegral.h" #include "../CustomTestLayouts.h" +// This test uses the bracket operator, but its not something we have at configure time +#if MDSPAN_USE_BRACKET_OPERATOR + // Clang 16 does not support argument packs as input to operator [] #if defined(__clang_major__) && __clang_major__ < 17 template @@ -254,6 +257,9 @@ int main(int, char**) { test_large(); return 0; } + +#endif // MDSPAN_USE_BRACKET_OPERATOR + #if defined(__GNUC__) && !defined(__clang_major__) # pragma GCC diagnostic pop #endif diff --git a/tests/libcxx-backports/mdspan/mdspan.properties.pass.cpp b/tests/libcxx-backports/mdspan/mdspan.properties.pass.cpp index 93adf613..dab43a13 100644 --- a/tests/libcxx-backports/mdspan/mdspan.properties.pass.cpp +++ b/tests/libcxx-backports/mdspan/mdspan.properties.pass.cpp @@ -118,7 +118,7 @@ constexpr void test_mdspan_types(const H& handle, const M& map, const A& acc) { } else { assert(m.size() == 1); } - //ASSERT_SAME_TYPE(decltype(m.size()), typename MDS::size_type); //FIXME + ASSERT_SAME_TYPE(decltype(m.size()), typename MDS::size_type); ASSERT_NOEXCEPT(m.size()); // empty() @@ -141,12 +141,12 @@ constexpr void test_mdspan_types(const H& handle, const M& map, const A& acc) { ASSERT_SAME_TYPE(decltype(m.is_unique()), bool); ASSERT_SAME_TYPE(decltype(m.is_exhaustive()), bool); ASSERT_SAME_TYPE(decltype(m.is_strided()), bool); - //assert(!noexcept(MDS::is_always_unique())); //FIXME - //assert(!noexcept(MDS::is_always_exhaustive())); //FIXME - //assert(!noexcept(MDS::is_always_strided())); //FIXME - //assert(!noexcept(m.is_unique())); //FIXME - //assert(!noexcept(m.is_exhaustive())); //FIXME - //assert(!noexcept(m.is_strided())); //FIXME + assert(!noexcept(MDS::is_always_unique())); + assert(!noexcept(MDS::is_always_exhaustive())); + assert(!noexcept(MDS::is_always_strided())); + assert(!noexcept(m.is_unique())); + assert(!noexcept(m.is_exhaustive())); + assert(!noexcept(m.is_strided())); assert(MDS::is_always_unique() == M::is_always_unique()); assert(MDS::is_always_exhaustive() == M::is_always_exhaustive()); assert(MDS::is_always_strided() == M::is_always_strided()); @@ -209,6 +209,6 @@ constexpr bool test() { } int main(int, char**) { test(); - //static_assert(test()); //FIXME + static_assert(test()); return 0; } diff --git a/tests/libcxx-backports/mdspan/mdspan.swap.pass.cpp b/tests/libcxx-backports/mdspan/mdspan.swap.pass.cpp index cd0fa3b1..079fb9ef 100644 --- a/tests/libcxx-backports/mdspan/mdspan.swap.pass.cpp +++ b/tests/libcxx-backports/mdspan/mdspan.swap.pass.cpp @@ -43,11 +43,13 @@ constexpr void test_swap(MDS a, MDS b) { } // This check uses a side effect of layout_wrapping_integral::swap to make sure // mdspan calls the underlying components' swap via ADL + #if MDSPAN_HAS_CXX23 if !consteval { if constexpr (std::is_same_v>) { assert(MDS::mapping_type::swap_counter() > 0); } } + #endif } constexpr bool test() { diff --git a/tests/test_mdspan_size.cpp b/tests/test_mdspan_size.cpp index e7e0e4ef..60286a12 100644 --- a/tests/test_mdspan_size.cpp +++ b/tests/test_mdspan_size.cpp @@ -37,19 +37,20 @@ std::size_t product_of_extents(const Extents& e) template void test_mdspan_size(std::vector& storage, Extents&& e) { - const std::size_t min_storage_size = product_of_extents(e); + using extents_type = std::remove_cv_t>; + using mdspan_t = Kokkos::mdspan; + const typename mdspan_t::size_type min_storage_size = product_of_extents(e); if(storage.size() < min_storage_size) { storage.resize(min_storage_size); } - using extents_type = std::remove_cv_t>; - Kokkos::mdspan m(storage.data(), std::forward(e)); + mdspan_t m(storage.data(), std::forward(e)); - static_assert(std::is_same::value, - "The return type of mdspan::size() must be size_t."); + static_assert(std::is_same::value, + "The return type of mdspan::size() must be size_type."); // m.size() must not overflow, as long as the product of extents - // is representable as a value of type size_t. - ASSERT_EQ( min_storage_size, m.size() ); + // is representable as a value of type size_type. + ASSERT_EQ( min_storage_size, m.size()); } TEST(TestMdspan, MdspanSizeReturnTypeAndPrecondition) @@ -58,9 +59,6 @@ TEST(TestMdspan, MdspanSizeReturnTypeAndPrecondition) static_assert(std::numeric_limits::max() == 127, "max int8_t != 127"); test_mdspan_size(storage, Kokkos::extents{}); // 12 * 11 == 132 - - static_assert(std::numeric_limits::max() == 255, "max uint8_t != 255"); - test_mdspan_size(storage, Kokkos::extents{}); // 16 * 17 == 272 } } // namespace (anonymous)