mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
f6e543b15e
With this change, and cast.h as-is in master, test_tagbased_polymorphic.cpp fails to compile with the error message below. With the cast.h change in pull/2016, building and testing succeeds. cd pybind11/build/tests && /usr/bin/c++ -DPYBIND11_TEST_BOOST -DPYBIND11_TEST_EIGEN -Dpybind11_tests_EXPORTS -Ipybind11/include -I/usr/include/python3.7m -isystem /usr/include/eigen3 -Os -DNDEBUG -fPIC -fvisibility=hidden -std=c++2a -flto -fno-fat-lto-objects -Wall -Wextra -Wconversion -Wcast-qual -Wdeprecated -o CMakeFiles/pybind11_tests.dir/test_tagbased_polymorphic.cpp.o -c pybind11/tests/test_tagbased_polymorphic.cpp In file included from pybind11/include/pybind11/attr.h:13, from pybind11/include/pybind11/pybind11.h:44, from pybind11/tests/pybind11_tests.h:2, from pybind11/tests/test_tagbased_polymorphic.cpp:10: pybind11/include/pybind11/cast.h: In instantiation of ‘static std::pair<const void*, const pybind11::detail::type_info*> pybind11::detail::type_caster_base<type>::src_and_type(const itype*) [with type = Animal; pybind11::detail::type_caster_base<type>::itype = Animal]’: pybind11/include/pybind11/cast.h:906:31: required from ‘static pybind11::handle pybind11::detail::type_caster_base<type>::cast_holder(const itype*, const void*) [with type = Animal; pybind11::detail::type_caster_base<type>::itype = Animal]’ pybind11/include/pybind11/cast.h:1566:51: required from ‘static pybind11::handle pybind11::detail::move_only_holder_caster<type, holder_type>::cast(holder_type&&, pybind11::return_value_policy, pybind11::handle) [with type = Animal; holder_type = std::unique_ptr<Animal>]’ pybind11/include/pybind11/stl.h:175:69: required from ‘static pybind11::handle pybind11::detail::list_caster<Type, Value>::cast(T&&, pybind11::return_value_policy, pybind11::handle) [with T = std::vector<std::unique_ptr<Animal> >; Type = std::vector<std::unique_ptr<Animal> >; Value = std::unique_ptr<Animal>]’ pybind11/include/pybind11/pybind11.h:159:43: required from ‘void pybind11::cpp_function::initialize(Func&&, Return (*)(Args ...), const Extra& ...) [with Func = std::vector<std::unique_ptr<Animal> > (*&)(); Return = std::vector<std::unique_ptr<Animal> >; Args = {}; Extra = {pybind11::name, pybind11::scope, pybind11::sibling}]’ pybind11/include/pybind11/pybind11.h:64:9: required from ‘pybind11::cpp_function::cpp_function(Return (*)(Args ...), const Extra& ...) [with Return = std::vector<std::unique_ptr<Animal> >; Args = {}; Extra = {pybind11::name, pybind11::scope, pybind11::sibling}]’ pybind11/include/pybind11/pybind11.h:819:22: required from ‘pybind11::module& pybind11::module::def(const char*, Func&&, const Extra& ...) [with Func = std::vector<std::unique_ptr<Animal> > (*)(); Extra = {}]’ pybind11/tests/test_tagbased_polymorphic.cpp:141:36: required from here pybind11/include/pybind11/cast.h:880:61: error: ambiguous template instantiation for ‘struct pybind11::polymorphic_type_hook<Animal, void>’ const void *vsrc = polymorphic_type_hook<itype>::get(src, instance_type); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ pybind11/include/pybind11/cast.h:844:8: note: candidates are: ‘template<class itype> struct pybind11::polymorphic_type_hook<itype, typename std::enable_if<std::is_polymorphic<_Tp>::value, void>::type> [with itype = Animal]’ struct polymorphic_type_hook<itype, detail::enable_if_t<std::is_polymorphic<itype>::value>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pybind11/tests/test_tagbased_polymorphic.cpp:115:12: note: ‘template<class itype> struct pybind11::polymorphic_type_hook<itype, typename std::enable_if<std::is_base_of<Animal, itype>::value, void>::type> [with itype = Animal]’ struct polymorphic_type_hook<itype, detail::enable_if_t<std::is_base_of<Animal, itype>::value>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from pybind11/include/pybind11/attr.h:13, from pybind11/include/pybind11/pybind11.h:44, from pybind11/tests/pybind11_tests.h:2, from pybind11/tests/test_tagbased_polymorphic.cpp:10: pybind11/include/pybind11/cast.h:880:61: error: incomplete type ‘pybind11::polymorphic_type_hook<Animal, void>’ used in nested name specifier const void *vsrc = polymorphic_type_hook<itype>::get(src, instance_type); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ |
||
---|---|---|
.. | ||
test_cmake_build | ||
test_embed | ||
CMakeLists.txt | ||
conftest.py | ||
constructor_stats.h | ||
cross_module_gil_utils.cpp | ||
local_bindings.h | ||
object.h | ||
pybind11_cross_module_tests.cpp | ||
pybind11_tests.cpp | ||
pybind11_tests.h | ||
pytest.ini | ||
test_async.cpp | ||
test_async.py | ||
test_buffers.cpp | ||
test_buffers.py | ||
test_builtin_casters.cpp | ||
test_builtin_casters.py | ||
test_call_policies.cpp | ||
test_call_policies.py | ||
test_callbacks.cpp | ||
test_callbacks.py | ||
test_chrono.cpp | ||
test_chrono.py | ||
test_class.cpp | ||
test_class.py | ||
test_constants_and_functions.cpp | ||
test_constants_and_functions.py | ||
test_copy_move.cpp | ||
test_copy_move.py | ||
test_docstring_options.cpp | ||
test_docstring_options.py | ||
test_eigen.cpp | ||
test_eigen.py | ||
test_enum.cpp | ||
test_enum.py | ||
test_eval_call.py | ||
test_eval.cpp | ||
test_eval.py | ||
test_exceptions.cpp | ||
test_exceptions.py | ||
test_factory_constructors.cpp | ||
test_factory_constructors.py | ||
test_gil_scoped.cpp | ||
test_gil_scoped.py | ||
test_iostream.cpp | ||
test_iostream.py | ||
test_kwargs_and_defaults.cpp | ||
test_kwargs_and_defaults.py | ||
test_local_bindings.cpp | ||
test_local_bindings.py | ||
test_methods_and_attributes.cpp | ||
test_methods_and_attributes.py | ||
test_modules.cpp | ||
test_modules.py | ||
test_multiple_inheritance.cpp | ||
test_multiple_inheritance.py | ||
test_numpy_array.cpp | ||
test_numpy_array.py | ||
test_numpy_dtypes.cpp | ||
test_numpy_dtypes.py | ||
test_numpy_vectorize.cpp | ||
test_numpy_vectorize.py | ||
test_opaque_types.cpp | ||
test_opaque_types.py | ||
test_operator_overloading.cpp | ||
test_operator_overloading.py | ||
test_pickling.cpp | ||
test_pickling.py | ||
test_pytypes.cpp | ||
test_pytypes.py | ||
test_sequences_and_iterators.cpp | ||
test_sequences_and_iterators.py | ||
test_smart_ptr.cpp | ||
test_smart_ptr.py | ||
test_stl_binders.cpp | ||
test_stl_binders.py | ||
test_stl.cpp | ||
test_stl.py | ||
test_tagbased_polymorphic.cpp | ||
test_tagbased_polymorphic.py | ||
test_union.cpp | ||
test_union.py | ||
test_virtual_functions.cpp | ||
test_virtual_functions.py |