Fix build failure when shared_ptr<T> points to private std::enable_shared_from_this base (#5590)

* Squashed private_esft/manuscript — 3f2b1201b830d9e431448bd8f5fe577afaa02dbf — 2025-03-30 12:38:30 -0700

[Browse private_esft/manuscript tree](3f2b1201b8)

[Browse private_esft/manuscript commits](3f2b1201b8/)

* Remove mention of ChatGPT

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
This commit is contained in:
Ralf W. Grosse-Kunstleve
2025-03-30 19:43:40 -07:00
committed by GitHub
parent e7e5d6e5bb
commit 8726ed22d8
4 changed files with 36 additions and 1 deletions

View File

@@ -473,4 +473,13 @@ TEST_SUBMODULE(smart_ptr, m) {
}
return list;
});
class PrivateESFT : /* implicit private */ std::enable_shared_from_this<PrivateESFT> {};
struct ContainerUsingPrivateESFT {
std::shared_ptr<PrivateESFT> ptr;
};
py::class_<ContainerUsingPrivateESFT>(m, "ContainerUsingPrivateESFT")
.def(py::init<>())
.def_readwrite("ptr",
&ContainerUsingPrivateESFT::ptr); // <- access ESFT through shared_ptr
}