int removeIndex(std::vector<int> indices);</int>
gives code like this:
{
Tcl_Obj **listobjv;
int nitems;
int temp;
std::vector<int> *v;
if(SWIG_ConvertPtr(argv[1], (void **) &v, \
SWIGTYPE_p_std__vectorTint_t, 0) == 0){
/* wrapped vector */
_v = 1;
} else {
// It isn't a vector<int> so it should be a list of int's
if(Tcl_ListObjGetElements(interp, argv[1],
&nitems, &listobjv) == TCL_ERROR)
_v = 0;
else
if (nitems == 0)
_v = 1;
//check the first value to see if it is of correct type
if (Tcl_GetIntFromObj(interp, listobjv[0], &temp) == TCL_ERROR)
_v = 0;
else
_v = 1;
}
Notice that the nitems == 0 test will not prevent the Tcl_GetIntFromObj to access listobjv[0] which causes a crash.
I also have this in my .i:
%template(intVector) std::vector<int>;
in case that matters</int>
Diff:
I've committed a fix which should be in SWIG 4.2.0: