From 9bb3313162c0b856125e481ceece9d8faa567716 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sun, 7 Apr 2019 10:38:10 +0200 Subject: [PATCH] Fixing warnings about conversions in GCC 7+ (#1753) --- include/pybind11/numpy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index ca954f59f..b2a02e024 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -855,14 +855,14 @@ public: // Reference to element at a given index template const T& at(Ix... index) const { - if (sizeof...(index) != ndim()) + if ((ssize_t) sizeof...(index) != ndim()) fail_dim_check(sizeof...(index), "index dimension mismatch"); return *(static_cast(array::data()) + byte_offset(ssize_t(index)...) / itemsize()); } // Mutable reference to element at a given index template T& mutable_at(Ix... index) { - if (sizeof...(index) != ndim()) + if ((ssize_t) sizeof...(index) != ndim()) fail_dim_check(sizeof...(index), "index dimension mismatch"); return *(static_cast(array::mutable_data()) + byte_offset(ssize_t(index)...) / itemsize()); }