# HG changeset patch # User Markus Mützel # Date 1607873103 -3600 # Sun Dec 13 16:25:03 2020 +0100 # Branch stable # Node ID f73337180c74ea2d5b9f37573f63bd7c30353fab # Parent eec0fe95576efd836b7ac8be3f1f7699ea73bf4e bug #59661 diff --git a/libinterp/octave-value/ov-fcn-handle.cc b/libinterp/octave-value/ov-fcn-handle.cc --- a/libinterp/octave-value/ov-fcn-handle.cc +++ b/libinterp/octave-value/ov-fcn-handle.cc @@ -27,6 +27,8 @@ # include "config.h" #endif +#include + #include #include #include @@ -436,7 +438,22 @@ namespace octave // 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_method (m_name, m_dispatch_class); + + return m_fcn.is_defined () ? m_fcn.function_value () : nullptr; } octave_user_function * user_function_value (bool = false)