Boost C++ Libraries: Ticket #925: export inhereted method under gcc fails https://svn.boost.org/trac10/ticket/925 <pre class="wiki">When I try to export a method inhereted from some base class, I get compilation errors unless I also export the base class. I've got a feeling it's compiler bug (gcc 2.96), but I am not entirely sure. .................................... class Base { public: int f(int i) { return -i; } }; class Derived : public Base { }; BOOST_PYTHON_MODULE_INIT(ex_pmf_ext) { try { python::module_builder this_module("ex_pmf_ext"); python::class_builder&lt;Derived&gt; derived_class(this_module, "Derived"); derived_class.def(python::constructor&lt;&gt;()); derived_class.def(&amp;Derived::f, "f"); } catch(...) { python::handle_exception(); } } ....................... The compiler says it can't find 'from_python()' function for 'Base' class. The error message also shows that the compiler sees '&amp;Base::f' pointer-to-member instead of '&amp;Derived::f'. That silent conversion seems to be a primary cause of the entire problem. ...instantiated from `boost::python::detail::wrapped_function_pointer&lt;R, F&gt;::do_call (PyObject *, PyObject *) const [with R = int, F = int ({unnamed}::Base::*) (int)]'... If I add ... python::class_builder&lt;Base&gt; base_class(this_module, "Base"); derived_class.declare_base(base_class,python::without_downcast); ... then everything works. However, it's obviously a nuisance since the entire class hierarchy may be quite convoluted or undocumented in general case (inhereted from vendor-supplied library, for instance), and I only care about using this method through my 'Derived' class, not the 'Base' class directly. Is this a bug in the compiler (it does not have the right to replace &amp;Derived::f with &amp;Base::f, does it)? Of cause, I can define and export functions like int f(Derived *self,int i) { return self-&gt;f(i); } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/925 Trac 1.4.3 david_abrahams Wed, 28 May 2003 10:20:55 GMT status changed https://svn.boost.org/trac10/ticket/925#comment:1 https://svn.boost.org/trac10/ticket/925#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> Ticket