diff libinterp/corefcn/sub2ind.cc @ 28004:403df0b32204

update out_of_range error messages * sub2ind.cc (Fsub2ind): Don't redimension dim_vector object so that the sub2ind function may report original dimensions in error messages. * Range.h (Range::dims): New function. * lo-array-errwarn.h, lo-array-errwarn.cc (out_of_range::set_size, out_of_range::set_extent): Delete. (out_of_range::out_of_range): Accept size and extent arguments. (out_of_range::details): Simplify. Always report extent and dimensions. (err_index_out_of_range): Deprecate overload that does not accept dim_vector argument. Change all uses to call the one that does. Simplify by passing extent and dims to out_of_range_object constructor. * test/index.tst: Update error messages in tests.
author John W. Eaton <jwe@octave.org>
date Sat, 25 Jan 2020 16:56:27 -0500
parents bd51beb6205e
children 9a965fec21c1
line wrap: on
line diff
--- a/libinterp/corefcn/sub2ind.cc	Sat Jan 25 12:43:31 2020 -0500
+++ b/libinterp/corefcn/sub2ind.cc	Sat Jan 25 16:56:27 2020 -0500
@@ -114,7 +114,8 @@
   if (nargin < 2)
     print_usage ();
 
-  dim_vector dv = get_dim_vector (args(0), "sub2ind").redim (nargin - 1);
+  dim_vector dv = get_dim_vector (args(0), "sub2ind");
+
   Array<idx_vector> idxa (dim_vector (nargin-1, 1));
 
   for (int j = 0; j < nargin - 1; j++)