Mercurial > octave
diff libinterp/octave-value/ov-struct.cc @ 27061:d61825e693f2
warn about indexing values with () (bug #56167)
* errwarn.h, errwarn.cc (warn_empty_index): New function.
* Cell.cc (Cell::index): Use it if indexing with ().
* ov-base-mat.cc (octave_base_matrix<MT>::do_index_op): Likewise.
* ov-struct.cc (octave_map::do_index_op): Likewise.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 23 Apr 2019 18:46:12 +0000 |
parents | 2d7615a07002 |
children | 1bad33112465 |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-struct.cc Tue Apr 23 10:47:02 2019 +0000 +++ b/libinterp/octave-value/ov-struct.cc Tue Apr 23 18:46:12 2019 +0000 @@ -539,7 +539,10 @@ octave_struct::do_index_op (const octave_value_list& idx, bool resize_ok) { if (idx.length () == 0) - return map; + { + warn_empty_index (type_name ()); + return map; + } else // octave_map handles indexing itself. return map.index (idx, resize_ok); }