Re: [Boost-bugs] [Boost C++ Libraries] #2776: Failed to wrap classes with virtual inheritance

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2776: Failed to wrap classes with virtual inheritance
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-02-18 20:32:34


#2776: Failed to wrap classes with virtual inheritance
--------------------------------------------------------+-------------------
  Reporter: Alexander Kogan <alexander_at_[hidden]> | Owner: dave
      Type: Bugs | Status: new
 Milestone: Boost 1.39.0 | Component: Python
   Version: | Severity: Problem
Resolution: | Keywords:
--------------------------------------------------------+-------------------

Comment(by roman.yakovenko_at_[hidden]):

 The bug description:

 The user has two classes:

 struct base{
    virtual void do_smth() {}
 };

 struct derived : virtual public base
 {};


 and exposes them using the following code:


 namespace bp = boost::python;

 struct base_wrapper : base, bp::wrapper< base > {
    <<< constructors >>>
    virtual void do_smth() {...}
    void default_do_smth( ) {...}
 };

 struct derived_wrapper : derived, bp::wrapper< derived > {
    <<< constructors >>>

    virtual void do_smth() {...}
    void default_do_smth() {...}

 };

 BOOST_PYTHON_MODULE(virtual_inheritance){
    bp::class_< base_wrapper >( "base" )
        .def(
            "do_smth"
            , (void ( ::base::* )( ) )(&::base::do_smth)
            , (void ( base_wrapper::* )( )
 )(&base_wrapper::default_do_smth) );

    bp::class_< derived_wrapper, bp::bases< base > >( "derived" )
        .def(
            "do_smth"
            , (void ( ::base::* )( ) )(&::base::do_smth)
            , (void ( derived_wrapper::* )( )
 )(&derived_wrapper::default_do_smth) ); //compiler complains to this
 line
 }

 GCC 4.1.3 and MSVC 7.1 complain on the last line. If the user removes
 "virtual" from inheritance everything works fine.

 In the past, a bug similar to this one was already fixed:
 http://mail.python.org/pipermail/cplusplus-sig/2003-September/005197.html

 I also attach source code and generated code. It is pretty close to
 "minimum".

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2776#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC