Commit f6e543b1 authored by Ralf W. Grosse-Kunstleve's avatar Ralf W. Grosse-Kunstleve Committed by Wenzel Jakob
Browse files

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 ...
parent 4697149d
......@@ -12,6 +12,12 @@
struct Animal
{
// Make this type also a "standard" polymorphic type, to confirm that
// specializing polymorphic_type_hook using enable_if_t still works
// (https://github.com/pybind/pybind11/pull/2016/).
virtual ~Animal() = default;
// Enum for tag-based polymorphism.
enum class Kind {
Unknown = 0,
Dog = 100, Labrador, Chihuahua, LastDog = 199,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment