mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-27 18:47:46 +00:00
* Add regression test for #5989: static_pointer_cast fails with virtual inheritance When a class uses virtual inheritance and its holder type is shared_ptr, passing a shared_ptr of the derived type as a method argument triggers a compilation error because static_pointer_cast cannot downcast through a virtual base (dynamic_pointer_cast is needed instead). Made-with: Cursor * Fix #5989: use dynamic_pointer_cast for virtual inheritance in esft downcast Replace the unconditional static_pointer_cast in set_via_shared_from_this with a SFINAE-dispatched esft_downcast helper that falls back to dynamic_pointer_cast when static_cast through a virtual base is ill-formed. Also add a workaround in the test binding (.def("name") on SftVirtDerived2) for a separate pre-existing issue with inherited method dispatch through virtual bases. Made-with: Cursor
25 KiB
25 KiB