diff --git a/include/chaiscript/dispatchkit/handle_return.hpp b/include/chaiscript/dispatchkit/handle_return.hpp index 564d9702..f1c908b0 100644 --- a/include/chaiscript/dispatchkit/handle_return.hpp +++ b/include/chaiscript/dispatchkit/handle_return.hpp @@ -83,6 +83,19 @@ namespace chaiscript } }; + /** + * Used internally for handling a return value from a Proxy_Function call + */ + template<> + struct Handle_Return + { + static Boxed_Value handle(const Boxed_Value &r) + { + return r; + } + }; + + /** * Used internally for handling a return value from a Proxy_Function call */ diff --git a/include/chaiscript/dispatchkit/proxy_functions.hpp b/include/chaiscript/dispatchkit/proxy_functions.hpp index eb378227..516b0a1b 100644 --- a/include/chaiscript/dispatchkit/proxy_functions.hpp +++ b/include/chaiscript/dispatchkit/proxy_functions.hpp @@ -442,10 +442,11 @@ namespace chaiscript if (bv.is_const()) { const Class *o = boxed_cast(bv); - return Boxed_Value( boost::ref(o->*m_attr) ); + return Handle_Return::type>::type>::handle(o->*m_attr); } else { Class *o = boxed_cast(bv); - return Boxed_Value( boost::ref(o->*m_attr) ); + return Handle_Return::type>::handle(o->*m_attr); +// return Boxed_Value( boost::ref(o->*m_attr) ); } } else { throw arity_error(params.size(), 1);