Ralf W. Grosse-Kunstleve
f6e543b15e
Adding a default virtual destructor to Animal type in test_tagbased_polymorphic.cpp.
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);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
2020-04-14 17:48:43 +02:00
..
2017-08-07 23:08:20 +02:00
2018-07-19 16:12:39 -03:00
2019-07-18 09:02:35 +02:00
2019-07-18 09:02:35 +02:00
2019-11-24 08:33:05 +01:00
2019-07-15 16:47:02 +02:00
2017-09-10 12:28:03 +02:00
2017-01-31 17:05:44 +01:00
2017-09-12 08:06:46 +02:00
2017-08-05 18:46:22 -04:00
2017-08-05 18:46:22 -04:00
2019-02-04 16:09:21 +01:00
2019-07-18 09:02:35 +02:00
2019-07-18 09:02:35 +02:00
2019-11-24 08:33:05 +01:00
2019-11-24 08:33:05 +01:00
2019-12-19 12:16:24 +01:00
2019-12-19 12:16:24 +01:00
2017-11-22 17:37:41 -04:00
2017-09-06 10:21:11 +02:00
2019-06-11 23:28:58 +02:00
2019-06-11 23:28:58 +02:00
2019-06-13 09:17:10 +02:00
2019-07-19 11:28:48 +02:00
2018-11-09 20:14:53 +01:00
2018-11-09 20:14:53 +01:00
2017-11-22 17:37:41 -04:00
2017-08-05 18:46:22 -04:00
2017-09-16 12:02:49 +02:00
2019-10-23 13:19:58 +02:00
2017-08-05 18:46:22 -04:00
2017-08-05 18:46:22 -04:00
2018-02-27 22:46:56 -04:00
2019-07-06 17:35:31 +02:00
2019-09-19 18:23:27 +02:00
2019-09-20 11:06:10 +02:00
2016-11-20 21:21:54 +01:00
2017-08-05 18:46:22 -04:00
2017-08-05 18:46:22 -04:00
2019-11-14 08:56:58 +01:00
2019-11-14 08:56:58 +01:00
2017-11-22 17:37:41 -04:00
2017-08-28 16:08:53 +02:00
2019-07-15 16:47:02 +02:00
2019-07-15 16:47:02 +02:00
2017-08-25 02:12:43 +02:00
2018-08-29 12:10:48 +02:00
2019-04-06 19:09:39 +02:00
2017-12-27 11:04:24 -04:00
2017-09-10 12:28:03 +02:00
2019-07-06 17:35:31 +02:00
2019-08-19 12:54:33 +02:00
2019-07-06 17:35:31 +02:00
2017-08-05 18:46:22 -04:00
2017-08-05 18:46:22 -04:00
2017-11-22 17:37:41 -04:00
2017-08-17 09:33:27 -04:00
2019-07-23 13:17:20 +02:00
2019-07-27 11:35:32 +02:00
2019-07-15 13:31:03 +02:00
2018-02-18 18:36:11 +01:00
2017-08-05 18:46:22 -04:00
2017-08-05 18:46:22 -04:00
2018-03-10 14:24:23 -04:00
2017-10-25 08:18:21 -03:00
2019-06-22 12:07:41 +02:00
2019-06-22 12:07:41 +02:00
2017-09-06 15:20:52 +02:00
2018-09-11 22:08:26 +02:00
2019-08-19 23:00:36 +02:00
2019-08-19 23:00:36 +02:00
2019-06-11 23:28:58 +02:00
2019-06-11 23:28:58 +02:00
2019-04-06 19:09:39 +02:00
2019-07-06 17:35:31 +02:00
2019-10-31 12:38:24 +01:00
2020-01-17 01:16:56 +01:00
2018-11-16 06:45:19 +01:00
2019-06-10 21:01:11 +02:00
2020-04-14 17:48:43 +02:00
2018-04-14 02:13:10 +02:00
2019-06-11 23:28:58 +02:00
2019-06-11 23:28:58 +02:00
2019-04-06 19:09:39 +02:00
2018-09-11 09:32:45 +02:00