# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1313101045 18000 # Node ID 5a5cb2a4b71d72156f2c1770bc33fefecf789b07 # Parent d1db86336a4905e255b43d64df66fd4648b9cb4e cellfun: Fix a regression for function handles to overloaded functions diff --git a/src/DLD-FUNCTIONS/cellfun.cc b/src/DLD-FUNCTIONS/cellfun.cc --- a/src/DLD-FUNCTIONS/cellfun.cc +++ b/src/DLD-FUNCTIONS/cellfun.cc @@ -58,6 +58,8 @@ #include "ov-uint32.h" #include "ov-uint64.h" +#include "ov-fcn-handle.h" + static octave_value_list get_output_list (octave_idx_type count, octave_idx_type nargout, const octave_value_list& inputlist, @@ -359,11 +361,22 @@ // for each value of the array. if (! symbol_table_lookup ) { - octave_value f = symbol_table::find_function ( func.function_value () + if (func.is_function_handle ()) + { + octave_fcn_handle* f = func.fcn_handle_value (); + + // Overloaded function handles need to check the type of + // the arguments for each element of the array, so they + // cannot be optimised this way. + if (f -> is_overloaded ()) + goto nevermind; + } + octave_value f = symbol_table::find_function (func.function_value () -> name ()); if (f.is_defined ()) func = f; } + nevermind: unwind_protect frame; frame.protect_var (buffer_error_messages);