From d5df842b1225dc0ad10b48a64374a390c718b558 Mon Sep 17 00:00:00 2001 From: Dean Moldovan Date: Tue, 3 Jan 2017 11:52:05 +0100 Subject: [PATCH] Fix pointer to reference error in type_caster on MSVC (#583) --- include/pybind11/cast.h | 4 ++-- include/pybind11/eigen.h | 4 ++-- include/pybind11/functional.h | 2 +- include/pybind11/numpy.h | 2 +- include/pybind11/pybind11.h | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index c7be40a2d..b953cc897 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -1015,14 +1015,14 @@ template struct move_always, negation>, std::is_move_constructible, - std::is_same>().operator T&()), T&> + std::is_same>().operator T&()), T&> >::value>> : std::true_type {}; template struct move_if_unreferenced : std::false_type {}; template struct move_if_unreferenced, negation>, std::is_move_constructible, - std::is_same>().operator T&()), T&> + std::is_same>().operator T&()), T&> >::value>> : std::true_type {}; template using move_never = none_of, move_if_unreferenced>; diff --git a/include/pybind11/eigen.h b/include/pybind11/eigen.h index d9a3aa9c5..ff720d5f6 100644 --- a/include/pybind11/eigen.h +++ b/include/pybind11/eigen.h @@ -137,7 +137,7 @@ struct type_caster> { protected: using Type = Eigen::Ref; using Derived = typename std::remove_const::type; - using DerivedCaster = type_caster; + using DerivedCaster = make_caster; DerivedCaster derived_caster; std::unique_ptr value; public: @@ -158,7 +158,7 @@ template struct type_caster::value && !is_eigen_ref::value>> { protected: using Matrix = Eigen::Matrix; - using MatrixCaster = type_caster; + using MatrixCaster = make_caster; public: [[noreturn]] bool load(handle, bool) { pybind11_fail("Unable to load() into specialized EigenBase object"); } static handle cast(const Type &src, return_value_policy policy, handle parent) { return MatrixCaster::cast(Matrix(src), policy, parent); } diff --git a/include/pybind11/functional.h b/include/pybind11/functional.h index 2dd52d3ec..8e7e75e6b 100644 --- a/include/pybind11/functional.h +++ b/include/pybind11/functional.h @@ -73,7 +73,7 @@ public: PYBIND11_TYPE_CASTER(type, _("Callable[[") + argument_loader::arg_names() + _("], ") + - type_caster::name() + + make_caster::name() + _("]")); }; diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 7d46f1078..6fecf2853 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -1140,7 +1140,7 @@ struct vectorize_helper { }; template struct handle_type_name> { - static PYBIND11_DESCR name() { return _("numpy.ndarray[") + type_caster::name() + _("]"); } + static PYBIND11_DESCR name() { return _("numpy.ndarray[") + make_caster::name() + _("]"); } }; NAMESPACE_END(detail) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 5835446ce..addcce74b 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1076,7 +1076,7 @@ public: struct capture { Func func; }; capture *ptr = new capture { std::forward(func) }; install_buffer_funcs([](PyObject *obj, void *ptr) -> buffer_info* { - detail::type_caster caster; + detail::make_caster caster; if (!caster.load(obj, false)) return nullptr; return new buffer_info(((capture *) ptr)->func(caster)); @@ -1480,7 +1480,7 @@ template void implicitly_convertible() { auto implicit_caster = [](PyObject *obj, PyTypeObject *type) -> PyObject * { - if (!detail::type_caster().load(obj, false)) + if (!detail::make_caster().load(obj, false)) return nullptr; tuple args(1); args[0] = obj;