kokkos / mdspan

Reference implementation of mdspan targeting C++23
Other
415 stars 69 forks source link

Comparison operator of `extents` may not work when `-Werror=sign-compare` is used #194

Open youyu3 opened 2 years ago

youyu3 commented 2 years ago

The implementation of the comparison operator led to compilation errors when -Werror=sign-compare is on, if one index type is signed while the other is unsigned.

@mhoemmen has suggested that:

We could fix this in any of various ways. Casting to common_type_t of the two index types before the comparison could help.

youyu3 commented 2 years ago

Similar issue in constructor of layout_{left|right} that takes a layout_stride::mapping, where size_t stride = 1; is compared against the stride of the input mapping, which could be signed.