You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version (or hash if on master) of pybind11 are you using?
2.11.1
Problem description
Similar to #2351. Though I have overloaded functions defined in child classes, instead of the base class.
I have a base class with multiple child classes. The base class does has a (pure) virtual function (with 2 doubles as arguments). The child classes overload this function with more doubles as arguments, the amount depends on the child class.
The issue is that the (pure) virtual function func is not inherited into the child classes. Only the overloaded version of the function is available in the child classes. The original function (2 doubles as arguments) is only available in the child classes when defining the function for each child. It doesn't matter whether I reference the base class or the child class in the definition. (See the commented lines in the child classes.) It also doesn't matter whether I use the py::overload_cast in the base class or not. (See commented line in the base class.)
The __copy__ and __deepcopy__ functions are inherited from the base class to the child classes without any issue.
The bug: The overloaded (pure) virtual function is not inherited into the child classes unless defined in the child classes.
edit: I think the issue is not related to the virtual functions, but the overloading of base functions in the child classes. As a fully implemented non-virtual function (func2) shows the same issue of not being inherited. Again only the overloaded version of the function is available.
Uh oh!
There was an error while loading. Please reload this page.
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
2.11.1
Problem description
Similar to #2351. Though I have overloaded functions defined in child classes, instead of the base class.
I have a base class with multiple child classes. The base class does has a (pure) virtual function (with 2 doubles as arguments). The child classes overload this function with more doubles as arguments, the amount depends on the child class.
The issue is that the (pure) virtual function
func
is not inherited into the child classes. Only the overloaded version of the function is available in the child classes. The original function (2 doubles as arguments) is only available in the child classes when defining the function for each child. It doesn't matter whether I reference the base class or the child class in the definition. (See the commented lines in the child classes.) It also doesn't matter whether I use thepy::overload_cast
in the base class or not. (See commented line in the base class.)The
__copy__
and__deepcopy__
functions are inherited from the base class to the child classes without any issue.The bug: The overloaded (pure) virtual function is not inherited into the child classes unless defined in the child classes.
edit: I think the issue is not related to the virtual functions, but the overloading of base functions in the child classes. As a fully implemented non-virtual function (
func2
) shows the same issue of not being inherited. Again only the overloaded version of the function is available.Reproducible example code
mylib.hpp
mylib_pybind.cpp
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered: