diff --git a/libinterp/corefcn/interpreter.cc b/libinterp/corefcn/interpreter.cc --- a/libinterp/corefcn/interpreter.cc +++ b/libinterp/corefcn/interpreter.cc @@ -1531,7 +1531,15 @@ namespace octave octave_function *of = fcn.function_value (); - return of->call (m_evaluator, nargout, args); + unwind_action act ([this] (const std::list *lvl) + { + m_evaluator.set_lvalue_list (lvl); + }, m_evaluator.lvalue_list ()); + m_evaluator.set_lvalue_list (nullptr); + + octave_value_list retval = of->call (m_evaluator, nargout, args); + + return retval; } octave_value_list interpreter::feval (octave_function *fcn, @@ -1539,7 +1547,15 @@ namespace octave int nargout) { if (fcn) - return fcn->call (m_evaluator, nargout, args); + { + unwind_action act ([this] (const std::list *lvl) + { + m_evaluator.set_lvalue_list (lvl); + }, m_evaluator.lvalue_list ()); + m_evaluator.set_lvalue_list (nullptr); + + return fcn->call (m_evaluator, nargout, args); + } return octave_value_list (); } @@ -1563,6 +1579,12 @@ namespace octave } else if (val.is_function_handle () || val.is_inline_function ()) { + unwind_action act ([this] (const std::list *lvl) + { + m_evaluator.set_lvalue_list (lvl); + }, m_evaluator.lvalue_list ()); + m_evaluator.set_lvalue_list (nullptr); + // This covers function handles, inline functions, and anonymous // functions.