Skip to content

[smart_holder]: trampoline_self_life_support -fvisibility question #3927

Open
@danielcjacobs

Description

@danielcjacobs

Required prerequisites

Problem description

I'm attempting to use the Progressive mode to solve a lifetime issue with a trampoline class via the following steps:

  1. Added -DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT to compilation commands
  2. Replaced std::shared_ptr<...> holder with PYBIND11_SH_DEF(Foo)
  3. 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<>())
}

Metadata

Metadata

Assignees

Labels

smart holderSee: https://github.com/pybind/pybind11/blob/smart_holder/README_smart_holder.rsttriageNew bug, unverified

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions