<snip> if you wrap a function

  const float& a();

Swig_MATLAB_NewPointerObj will attempt to create an object of type p_float, which matlab doesn't know what to do with, so we will fall back to a SwigRef. This example looks a bit artificial, but I get it because I am using templates ("template <class T> const T& a()") which I then instantiate with T=float. In C++, that's fine, but in MATLAB, we now end up with a largely unusable value. This is the same for other languages though (I think).

I don't see how this is related to the MATLAB module. My understanding is that if you want to define a different behavior, you have to define an output typemap.

Best regards,

P.S.: For particular issues like this, I think it's easier to use github's issue tracker.