From bfe36cc7df48265e471908e17146263d4e2f6dc1 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 4 Feb 2021 22:30:11 -0800 Subject: [PATCH] Softening static_assert, to only check specifically that smart_holder is not mixed with type_caster_base, and unique_ptr/shared_ptr holders are not mixed with smart_holder_type_casters. --- include/pybind11/pybind11.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 26977f020..00c5c0e0f 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1302,9 +1302,10 @@ public: record.default_holder = holder_is_smart_holder; #if 0 static constexpr bool type_caster_type_is_smart_holder_type_caster = detail::is_smart_holder_type_caster::value; + static constexpr bool type_caster_type_is_type_caster_base_subtype = std::is_base_of, detail::type_caster>::value; static_assert(!(detail::is_instantiation::value && type_caster_type_is_smart_holder_type_caster)); static_assert(!(detail::is_instantiation::value && type_caster_type_is_smart_holder_type_caster)); - static_assert(holder_is_smart_holder == type_caster_type_is_smart_holder_type_caster); + static_assert(!(holder_is_smart_holder && type_caster_type_is_type_caster_base_subtype)); #endif #endif set_operator_new(&record);