# HG changeset patch # User Markus Mützel # Date 1607873103 -3600 # Sun Dec 13 16:25:03 2020 +0100 # Node ID 605edd841784d0c730a8fba52a4cfe6d0e033d0e # Parent 576d0bf372a45838df7cb800f399ce6ef0e8a47a bug #59661 diff -r 576d0bf372a4 -r 605edd841784 libinterp/octave-value/ov-fcn-handle.cc --- a/libinterp/octave-value/ov-fcn-handle.cc Sat Dec 12 17:20:41 2020 +0100 +++ b/libinterp/octave-value/ov-fcn-handle.cc Sun Dec 13 16:25:03 2020 +0100 @@ -436,7 +436,22 @@ // scoping or overloads. octave_function * function_value (bool = false) { - return m_fcn.function_value (); + // FIXME: Shouldn't the lookup rules here match those used in the + // call method? + + if (m_fcn.is_defined ()) + return m_fcn.function_value (); + + symbol_table& symtab + = __get_symbol_table__ ("class_simple_fcn_handle::function_value"); + + // FIXME: is caching the correct thing to do? + // Cache this value so that the pointer will be valid as long as the + // function handle object is valid. + + m_fcn = symtab.find_function (m_name, octave_value_list ()); + + return m_fcn.is_defined () ? m_fcn.function_value () : nullptr; } octave_user_function * user_function_value (bool = false)