changeset 12952:5a5cb2a4b71d

cellfun: Fix a regression for function handles to overloaded functions
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Thu, 11 Aug 2011 17:17:25 -0500
parents d1db86336a49
children 332a97ea63ba
files src/DLD-FUNCTIONS/cellfun.cc
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);