Open
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
Problem description
I'm attempting to use the Progressive
mode to solve a lifetime issue with a trampoline class via the following steps:
- Added
-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT
to compilation commands - Replaced
std::shared_ptr<...>
holder withPYBIND11_SH_DEF(Foo)
- Inherit trampoline class from
public py::trampoline_self_life_support
When I compile, I get this warning:
warning: ‘PyFoo’ declared with greater visibility than its base ‘pybind11::trampoline_self_life_support’ [-Wattributes]
134 | class PyFoo : Foo, py::trampoline_self_life_support {
Reproducible example code
// C++
#include <pybind11/pybind11.h>
class Foo {
public:
virtual ~Foo() = default;
};
// Trampoline class
class PyFoo : Foo, public py::trampoline_self_life_support {
public:
using Foo::Foo;
};
// Bindings
PYBIND11_MODULE("smart_holder", m) {
py::class_<Foo, PyFoo, PYBIND11_SH_DEF(Foo)>(m, "Foo")
.def(py::init<>())
}