Fix directorout typemaps which were causing undefined behaviour when returning pointers by reference.

Closes #1167
This commit is contained in:
William S Fulton 2017-12-13 20:47:05 +00:00
commit e86c881a70
6 changed files with 24 additions and 7 deletions

View file

@ -380,6 +380,11 @@
%typemap(directorout) SWIGTYPE &
%{ *($&1_ltype)&$result = $input; %}
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE *const&
%{ static $*1_ltype swig_temp;
swig_temp = *($1_ltype)&$input;
$result = &swig_temp; %}
%typemap(gotype) SWIGTYPE &&
%{$gotypename%}