#1195 Compilation failure due to duplicate class member objects

open
csharp (36)
5
2012-12-21
2011-10-06
No

If a function is both overloaded and overridden, SWIG generates callback objects with duplicate names everywhere in derived class and the compilation fails as a result. Sample code is:
----------------
Test.h:

class Base
{
public:
virtual bool Print(int i){}
virtual bool Print(int i, double d){}
virtual ~Base(){}
};

class Derived : public Base
{
public:
virtual bool Print(int i, bool b){}
virtual bool Print(double i, int d, bool b){}
virtual ~Derived(){}
};

----------------
From generated header:

void swig_connect_director(SWIG_Callback0_t callbackPrint__SWIG_0, SWIG_Callback1_t callbackPrint__SWIG_1, SWIG_Callback2_t callbackPrint__SWIG_0, SWIG_Callback3_t callbackPrint__SWIG_1);

private:
SWIG_Callback0_t swig_callbackPrint__SWIG_0;
SWIG_Callback1_t swig_callbackPrint__SWIG_1;
SWIG_Callback2_t swig_callbackPrint__SWIG_0;
SWIG_Callback3_t swig_callbackPrint__SWIG_1;
void swig_init_callbacks();

Discussion


Log in to post a comment.