Skip to content

Commit 9bb3313

Browse files
henryiiiwjakob
authored andcommitted
Fixing warnings about conversions in GCC 7+ (#1753)
1 parent 73b840d commit 9bb3313

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/pybind11/numpy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,14 +855,14 @@ template <typename T, int ExtraFlags = array::forcecast> class array_t : public
855855

856856
// Reference to element at a given index
857857
template<typename... Ix> const T& at(Ix... index) const {
858-
if (sizeof...(index) != ndim())
858+
if ((ssize_t) sizeof...(index) != ndim())
859859
fail_dim_check(sizeof...(index), "index dimension mismatch");
860860
return *(static_cast<const T*>(array::data()) + byte_offset(ssize_t(index)...) / itemsize());
861861
}
862862

863863
// Mutable reference to element at a given index
864864
template<typename... Ix> T& mutable_at(Ix... index) {
865-
if (sizeof...(index) != ndim())
865+
if ((ssize_t) sizeof...(index) != ndim())
866866
fail_dim_check(sizeof...(index), "index dimension mismatch");
867867
return *(static_cast<T*>(array::mutable_data()) + byte_offset(ssize_t(index)...) / itemsize());
868868
}

0 commit comments

Comments
 (0)