Mercurial > hg > octave-lyh
changeset 14568:82449d607d20 stable
correctly fill struct arrays for assignments that cause resizing (bug #33178)
* oct-map.cc (octave_map::assign): Pass Matrix fill value to cell
array assignment functions. New test.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 17 Apr 2012 13:13:22 -0400 |
parents | 5bb5fcffa29d |
children | 3a9a56999ce5 d07d96e53612 |
files | src/oct-map.cc |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -971,7 +971,7 @@ octave_idx_type nf = nfields (); for (octave_idx_type k = 0; k < nf; k++) - xvals[k].assign (i, rhs.xvals[k]); + xvals[k].assign (i, rhs.xvals[k], Matrix ()); if (nf > 0) dimensions = xvals[0].dims (); @@ -1014,7 +1014,7 @@ octave_idx_type nf = nfields (); for (octave_idx_type k = 0; k < nf; k++) - xvals[k].assign (i, j, rhs.xvals[k]); + xvals[k].assign (i, j, rhs.xvals[k], Matrix ()); if (nf > 0) dimensions = xvals[0].dims (); @@ -1057,7 +1057,7 @@ octave_idx_type nf = nfields (); for (octave_idx_type k = 0; k < nf; k++) - xvals[k].assign (ia, rhs.xvals[k]); + xvals[k].assign (ia, rhs.xvals[k], Matrix ()); if (nf > 0) dimensions = xvals[0].dims (); @@ -1170,6 +1170,13 @@ setfield (k, tmp); } +/* +%!test +%! rhs.b = 1; +%! a(3) = rhs; +%! assert ({a.b}, {[], [], 1}) +*/ + void octave_map::delete_elements (const idx_vector& i) {