|
From: Naveen K. <nav...@gm...> - 2008-08-12 15:33:16
|
Hi
I'm facing compilation errors in the generated code when trying to wrap
in python a class with static template member function. I have tried with
the 1.3.36 release and the current SVN version. G++ version is 4.2.3.
I have created a simple test case to reproduce the error
--- c++ code ---
template<class T>
class Foo
{
public:
template<class T1>
static T bar(T1 arg1)
{
return arg1;
}
};
--- swig template instantiation ---
%extend Foo
{
%template(bar) bar<int>;
}
%template(Foo_int) Foo<int>;
the generated code contains the following function
SWIGINTERN int Foo_Sl_int_Sg__bar<(int)>(int arg1){
return arg1;
}
however the correctly working code seems to be
SWIGINTERN int Foo_Sl_int_Sg__bar<(int)>(int arg1){
return arg1;
}
and the above function is called from the function _wrap_Foo_int_bar inside
which the line
result = (int)Foo_Sl_int_Sg__bar< int >(arg1);
needs to be replaced with
result = (int)Foo_Sl_int_Sg__bar(arg1);
The problem also occurs when the template function instantiation is
overloaded. I haven't checked if the problem occurs in other target
languages. I have tried to located the SWIG code which generates the above,
but no luck. I would appreciate any help in fixing the problem.
Thanks in advance
Regards
Naveen
|