diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index cad97eaa2..82c5423de 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1849,7 +1849,10 @@ public: record.holder_size = sizeof(holder_type); record.init_instance = init_instance; record.dealloc = dealloc; - record.default_holder = std::is_same::value; + + // A more fitting name would be uses_unique_ptr_holder. + record.default_holder = detail::is_instantiation::value; + #ifdef PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT if (detail::is_instantiation::value) { record.holder_enum_v = detail::holder_enum_t::std_unique_ptr; diff --git a/tests/test_class.cpp b/tests/test_class.cpp index e2981aca4..ba462fa85 100644 --- a/tests/test_class.cpp +++ b/tests/test_class.cpp @@ -211,11 +211,12 @@ TEST_SUBMODULE(class_, m) { m.def("mismatched_holder_1", []() { auto mod = py::module_::import("__main__"); py::class_>(mod, "MismatchBase1"); - py::class_(mod, "MismatchDerived1"); + py::class_, MismatchBase1>( + mod, "MismatchDerived1"); }); m.def("mismatched_holder_2", []() { auto mod = py::module_::import("__main__"); - py::class_(mod, "MismatchBase2"); + py::class_>(mod, "MismatchBase2"); py::class_, MismatchBase2>( mod, "MismatchDerived2"); });