Skip to content

Commit b31a635

Browse files
authored
Merge pull request #246 from wmaxey/bugfix_msvc_ICE
Fix an ICE on MSVC 14.3X
2 parents cf374bc + 38c7e8d commit b31a635

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

include/experimental/__p0009_bits/extents.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,20 @@ static constexpr std::false_type _check_compatible_extents(
5050
std::false_type, std::integer_sequence<size_t, Extents...>, std::integer_sequence<size_t, OtherExtents...>
5151
) noexcept { return { }; }
5252

53+
// This helper prevents ICE's on MSVC.
54+
template <size_t Lhs, size_t Rhs>
55+
struct _compare_extent_compatible : std::integral_constant<bool,
56+
Lhs == dynamic_extent ||
57+
Rhs == dynamic_extent ||
58+
Lhs == Rhs>
59+
{};
60+
5361
template <size_t... Extents, size_t... OtherExtents>
5462
static std::integral_constant<
5563
bool,
5664
_MDSPAN_FOLD_AND(
5765
(
58-
Extents == dynamic_extent
59-
|| OtherExtents == dynamic_extent
60-
|| Extents == OtherExtents
66+
_compare_extent_compatible<Extents, OtherExtents>::value
6167
) /* && ... */
6268
)
6369
>

include/experimental/__p0009_bits/layout_left.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class layout_left::mapping {
163163
)
164164
_MDSPAN_HOST_DEVICE
165165
constexpr index_type operator()(Indices... idxs) const noexcept {
166-
return __compute_offset(__rank_count<0, extents_type::rank()>(), idxs...);
166+
return __compute_offset(__rank_count<0, extents_type::rank()>(), static_cast<index_type>(idxs)...);
167167
}
168168

169169

include/experimental/__p0009_bits/layout_right.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class layout_right::mapping {
168168
)
169169
_MDSPAN_HOST_DEVICE
170170
constexpr index_type operator()(Indices... idxs) const noexcept {
171-
return __compute_offset(__rank_count<0, extents_type::rank()>(), idxs...);
171+
return __compute_offset(__rank_count<0, extents_type::rank()>(), static_cast<index_type>(idxs)...);
172172
}
173173

174174
MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return true; }

include/experimental/__p0009_bits/layout_stride.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ struct layout_stride {
415415
)
416416
MDSPAN_FORCE_INLINE_FUNCTION
417417
constexpr index_type operator()(Indices... idxs) const noexcept {
418-
return __impl::_call_op_impl(*this, static_cast<index_type>(idxs)...);
418+
return static_cast<index_type>(__impl::_call_op_impl(*this, static_cast<index_type>(idxs)...));
419419
}
420420

421421
MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return true; }

0 commit comments

Comments
 (0)