Skip to content

Commit

Permalink
Merge pull request #346 from crtrott/fix-more-msvc-issues
Browse files Browse the repository at this point in the history
Fix more MSVC issues
  • Loading branch information
crtrott authored Jun 17, 2024
2 parents 1fea934 + aff46cc commit 97c8eef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/experimental/__p0009_bits/mdspan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ class mdspan
#endif // MDSPAN_USE_PAREN_OPERATOR

MDSPAN_INLINE_FUNCTION constexpr size_type size() const noexcept {
return __impl::__size(*this);
return static_cast<size_type>(__impl::__size(*this));
};

MDSPAN_INLINE_FUNCTION constexpr bool empty() const noexcept {
Expand Down
2 changes: 1 addition & 1 deletion include/experimental/__p2642_bits/layout_padded.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct static_array_type_for_padded_extent
using extents_type = _Extents;
using type = ::MDSPAN_IMPL_STANDARD_NAMESPACE::detail::maybe_static_array<
index_type, size_t, dynamic_extent,
detail::get_actual_static_padding_value<extents_type, padding_value,
::MDSPAN_IMPL_STANDARD_NAMESPACE::MDSPAN_IMPL_PROPOSED_NAMESPACE::detail::get_actual_static_padding_value<extents_type, _PaddingValue,
_ExtentToPadIdx>()>;
};

Expand Down
5 changes: 3 additions & 2 deletions tests/test_mdspan_size.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ void test_mdspan_size(std::vector<char>& storage, Extents&& e)
{
using extents_type = std::remove_cv_t<std::remove_reference_t<Extents>>;
using mdspan_t = Kokkos::mdspan<char, extents_type>;
const typename mdspan_t::size_type min_storage_size = product_of_extents(e);
using size_type = typename mdspan_t::size_type;
const size_type min_storage_size = static_cast<size_type>(product_of_extents(e));
if(storage.size() < min_storage_size) {
storage.resize(min_storage_size);
}
mdspan_t m(storage.data(), std::forward<Extents>(e));

static_assert(std::is_same<decltype(m.size()), typename mdspan_t::size_type>::value,
static_assert(std::is_same<decltype(m.size()), size_type>::value,
"The return type of mdspan::size() must be size_type.");

// m.size() must not overflow, as long as the product of extents
Expand Down

0 comments on commit 97c8eef

Please sign in to comment.