#729 Missing overloaded method

open
python (259)
5
2012-12-21
2006-08-14
No

When having a c++ base class with a pure virtual method
and a class deriving from this class and implementing
that method, adding an overloaded version of the method
in the derived class is not handled correctly in SWIG
1.3.29.

Here's a simple example:

class Base
{
public:
Base() {}
virtual ~Base() {}

virtual void f\(int i, int j\) =0;

};

class Derived: public Base
{
public:
Derived() {}
virtual ~Derived() {}

virtual void f\(int i, int j\)

{ printf("f(i,j)\n"); }
virtual void f(int i)
{ printf("f(i)\n"); }
};

Notice the overloaded function f in Derived. When
running swig with "-c++ -python -O -modern" on the
attached interface (which contains these classes) the
2-parameter version of the method will not be available
in Derived:

Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for
more information.
>>> import virtual
>>> d=virtual.Derived()
>>> d.f(1)
f(i)
>>> d.f(2,3)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NotImplementedError: No matching function for
overloaded 'Derived_f'

Discussion

  • Paul E.C. Melis

    Paul E.C. Melis - 2006-08-14

    Simple interface file for demonstrating the problem

     
  • William Fulton

    William Fulton - 2006-11-10

    Logged In: YES
    user_id=242951

    Similar to #1593490

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks