# HG changeset patch # User John W. Eaton # Date 1296120173 18000 # Node ID 077ece977a7b6a15d3207fe67912c89b9b214ce8 # Parent 4f8069727e9f788c0e781b640f30fb6d8c8553b3 fix construction of class exemplars diff -r 4f8069727e9f -r 077ece977a7b src/ChangeLog --- a/src/ChangeLog Thu Jan 27 00:15:40 2011 -0500 +++ b/src/ChangeLog Thu Jan 27 04:22:53 2011 -0500 @@ -1,3 +1,10 @@ +2011-01-27 John W. Eaton + + * ov-class.cc (octave_class::reconstruct_exemplar): + Call constructor with do_multi_index_op instead of feval. + Verify that symbol_table::find_method did return a class + constructor for the correct type. + 2011-01-26 John W. Eaton * lex.ll, graphics.cc, gl-render.cc, ov-mex-fcn.h, graphics.h.in: diff -r 4f8069727e9f -r 077ece977a7b src/ov-class.cc --- a/src/ov-class.cc Thu Jan 27 00:15:40 2011 -0500 +++ b/src/ov-class.cc Thu Jan 27 04:22:53 2011 -0500 @@ -1068,9 +1068,25 @@ { octave_value ctor = symbol_table::find_method (c_name, c_name); - if (ctor.is_defined ()) + bool have_ctor = false; + + if (ctor.is_defined () && ctor.is_function ()) { - octave_value_list result = feval (ctor, 1); + octave_function *fcn = ctor.function_value (); + + if (fcn && fcn->is_class_constructor (c_name)) + have_ctor = true; + + // Something has gone terribly wrong if + // symbol_table::find_method (c_name, c_name) does not return + // a class constructor for the class c_name... + assert (have_ctor); + } + + if (have_ctor) + { + octave_value_list result + = ctor.do_multi_index_op (1, octave_value_list ()); if (result.length () == 1) retval = true;