mirror of
https://github.com/pybind/pybind11.git
synced 2026-06-06 06:11:25 +00:00
Add a polymorphic static assert when using an alias
An alias can be used for two main purposes: to override virtual methods, and to add some extra data to a class needed for the pybind-wrapper. Both of these absolutely require that the wrapped class be polymorphic so that virtual dispatch and destruction, respectively, works.
This commit is contained in:
@@ -231,7 +231,7 @@ TEST_SUBMODULE(class_, m) {
|
||||
bind_local<LocalExternal, 17>(m, "LocalExternal", py::module_local());
|
||||
}
|
||||
|
||||
template <int N> class BreaksBase {};
|
||||
template <int N> class BreaksBase { public: virtual ~BreaksBase() = default; };
|
||||
template <int N> class BreaksTramp : public BreaksBase<N> {};
|
||||
// These should all compile just fine:
|
||||
typedef py::class_<BreaksBase<1>, std::unique_ptr<BreaksBase<1>>, BreaksTramp<1>> DoesntBreak1;
|
||||
|
||||
Reference in New Issue
Block a user