diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 2713e13a8..b8ba2259f 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -647,8 +647,9 @@ private: for (auto field : attr("fields").attr("items")()) { auto spec = field.cast(); auto name = spec[0].cast(); - auto format = spec[1].cast()[0].cast(); - auto offset = spec[1].cast()[1].cast(); + auto spec_fo = spec[1].cast(); + auto format = spec_fo[0].cast(); + auto offset = spec_fo[1].cast(); if ((len(name) == 0u) && format.kind() == 'V') { continue; }