hey mate, i asked a similar question. This is what happens when you try to return a const reference via “normal” c++ way.
You can return a reference via the C way using it as an OutParam.
here is the link to my question.
however i havnt figured how to return it as const