aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/pybind11/tests/test_tagbased_polymorphic.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/pybind11/tests/test_tagbased_polymorphic.cpp')
-rw-r--r--3rdparty/pybind11/tests/test_tagbased_polymorphic.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/3rdparty/pybind11/tests/test_tagbased_polymorphic.cpp b/3rdparty/pybind11/tests/test_tagbased_polymorphic.cpp
index 272e460c..838a168d 100644
--- a/3rdparty/pybind11/tests/test_tagbased_polymorphic.cpp
+++ b/3rdparty/pybind11/tests/test_tagbased_polymorphic.cpp
@@ -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,
@@ -111,7 +117,7 @@ namespace pybind11 {
static const void *get(const itype *src, const std::type_info*& type)
{ type = src ? Animal::type_of_kind(src->kind) : nullptr; return src; }
};
-}
+} // namespace pybind11
TEST_SUBMODULE(tagbased_polymorphic, m) {
py::class_<Animal>(m, "Animal")