From 4409714ee3a9b1aa0fbeba9f3532d49d8de97a57 Mon Sep 17 00:00:00 2001 From: Christian Trott Date: Mon, 17 Jun 2024 09:19:28 -0600 Subject: [PATCH] Fix parsing error exposed on MSVC Also fixes missing constexpr --- include/experimental/__p2642_bits/layout_padded.hpp | 4 ++-- tests/test_submdspan.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/experimental/__p2642_bits/layout_padded.hpp b/include/experimental/__p2642_bits/layout_padded.hpp index 68d105a2..1291c4d7 100644 --- a/include/experimental/__p2642_bits/layout_padded.hpp +++ b/include/experimental/__p2642_bits/layout_padded.hpp @@ -221,7 +221,7 @@ class layout_left_padded::mapping { #endif MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(const mapping&) noexcept = default; - MDSPAN_INLINE_FUNCTION_DEFAULTED mapping& operator=(const mapping&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping& operator=(const mapping&) noexcept = default; /** * Initializes the mapping with the given extents. @@ -584,7 +584,7 @@ class layout_right_padded::mapping { #endif MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(const mapping&) noexcept = default; - MDSPAN_INLINE_FUNCTION_DEFAULTED mapping& operator=(const mapping&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping& operator=(const mapping&) noexcept = default; /** * Initializes the mapping with the given extents. diff --git a/tests/test_submdspan.cpp b/tests/test_submdspan.cpp index 16903f27..13069be5 100644 --- a/tests/test_submdspan.cpp +++ b/tests/test_submdspan.cpp @@ -207,6 +207,7 @@ using submdspan_test_types = , std::tuple, Kokkos::layout_stride, Kokkos::dextents, args_t<10,20,30>, Kokkos::dextents, Kokkos::full_extent_t, Kokkos::strided_slice, Kokkos::full_extent_t> , std::tuple, Kokkos::layout_stride, Kokkos::dextents, args_t<10,20,30>, Kokkos::dextents, Kokkos::full_extent_t, int, Kokkos::strided_slice> , std::tuple, Kokkos::layout_stride, Kokkos::dextents, args_t<10,20,30,40>, Kokkos::dextents, Kokkos::full_extent_t, Kokkos::full_extent_t, int, Kokkos::full_extent_t> + // layout_right_padded to layout_right , std::tuple, Kokkos::layout_right, Kokkos::dextents, args_t<10,20>, Kokkos::dextents, int, int> , std::tuple, Kokkos::layout_right, Kokkos::dextents, args_t<10,20>, Kokkos::dextents, int, std::pair> @@ -341,11 +342,10 @@ struct TestSubMDSpan< } static void run() { - typename mds_org_t::mapping_type map(typename mds_org_t::extents_type(ConstrArgs...)); - int data[25000]; - // MSVC seems to have an issue with taking just data here - mds_org_t src(&data[0], map); size_t* result = allocate_array(1); + int* data = allocate_array(25000); + map_t map{ typename mds_org_t::extents_type(ConstrArgs...) }; + mds_org_t src(data, map); dispatch([=] _MDSPAN_HOST_DEVICE () { auto sub = Kokkos::submdspan(src, create_slice_arg(SubArgs())...); @@ -353,6 +353,7 @@ struct TestSubMDSpan< result[0] = match?1:0; }); EXPECT_EQ(result[0], 1); + free_array(data); free_array(result); }