diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 3fe426a52..c06fb2666 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -191,7 +191,7 @@ private: std::sort(field_descriptors.begin(), field_descriptors.end(), [](const field_descr& a, const field_descr& b) { - return (int) a.offset < (int) b.offset; + return a.offset.cast() < b.offset.cast(); }); list names, formats, offsets;