swig/Examples/test-suite/template_extend_overload_2.i
Mark Gossage 0c2bbb25a3 [lua] fixed bug in template classes which cases template_default2 and template_specialization_defarg to fail.
Added several warning filters into the overload's test cases.
Added runtime tests for several codes.
You can now make check-lua-test-suite with no errors and only a few warnings.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10076 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-10-30 06:10:04 +00:00

121 lines
1.2 KiB
OpenEdge ABL

%module template_extend_overload_2
#ifdef SWIGLUA // lua only has one numeric type, so some overloads shadow each other creating warnings
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) A;
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) AT;
%warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) BT;
#endif
%inline %{
struct A
{
A()
{
}
A(int)
{
}
int hi()
{
return 0;
}
};
template <class T>
struct AT
{
AT()
{
}
AT(int)
{
}
int hi()
{
return 0;
}
};
template <class T>
struct BT
{
BT()
{
}
BT(int)
{
}
int hi()
{
return 0;
}
};
%}
%extend A
{
//
// this works
//
int hi(int)
{
return 0;
}
A(double i)
{
A* a = new A();
return a;
}
}
%template(AT_double) AT<double>;
%extend AT<double>
{
//
// this doesn't work
//
int hi(int)
{
return 1;
}
AT<double>(double i)
{
AT<double>* a = new AT<double>();
return a;
}
}
%extend BT<double>
{
//
// this doesn't work either
//
int hi(int)
{
return 1;
}
BT<double>(double i)
{
BT<double>* a = new BT<double>();
return a;
}
}
%template(BT_double) BT<double>;