diff --git a/include/pybind11/buffer_info.h b/include/pybind11/buffer_info.h index 8722d697ca..b99ee8bef4 100644 --- a/include/pybind11/buffer_info.h +++ b/include/pybind11/buffer_info.h @@ -160,8 +160,8 @@ struct buffer_info { // on some platforms, but `int` and `unsigned` will never be equivalent. // For the ground truth, please inspect `detail::compare_buffer_info<>`. template - static bool item_type_is_equivalent_to(const buffer_info &b) { - return detail::compare_buffer_info::compare(b); + bool item_type_is_equivalent_to() const { + return detail::compare_buffer_info::compare(*this); } private: diff --git a/tests/test_buffers.cpp b/tests/test_buffers.cpp index 1169891f23..b5b8c355b3 100644 --- a/tests/test_buffers.cpp +++ b/tests/test_buffers.cpp @@ -21,11 +21,11 @@ TEST_SUBMODULE(buffers, m) { // https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables static auto *format_table = new std::map; static auto *equiv_table - = new std::map; + = new std::map; if (format_table->empty()) { #define PYBIND11_ASSIGN_HELPER(...) \ (*format_table)[#__VA_ARGS__] = py::format_descriptor<__VA_ARGS__>::format(); \ - (*equiv_table)[#__VA_ARGS__] = py::buffer_info::item_type_is_equivalent_to<__VA_ARGS__>; + (*equiv_table)[#__VA_ARGS__] = &py::buffer_info::item_type_is_equivalent_to<__VA_ARGS__>; PYBIND11_ASSIGN_HELPER(PyObject *) PYBIND11_ASSIGN_HELPER(bool) PYBIND11_ASSIGN_HELPER(std::int8_t) @@ -44,8 +44,8 @@ TEST_SUBMODULE(buffers, m) { PYBIND11_ASSIGN_HELPER(std::complex) #undef PYBIND11_ASSIGN_HELPER } - return std::pair((*format_table)[cpp_name], - (*equiv_table)[cpp_name](buffer.request())); + return std::pair( + (*format_table)[cpp_name], (buffer.request().*((*equiv_table)[cpp_name]))()); }); // test_from_python / test_to_python: