Mercurial > hg > octave-nkf
changeset 19597:9887a930465f gui-release
maint: Periodic merge of stable to gui-release.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 15 Dec 2014 20:59:21 -0800 |
parents | 1085a65e9b9b (current diff) 2304ddfd736f (diff) |
children | 9035a36736af ed0df431631b |
files | libinterp/corefcn/data.cc |
diffstat | 2 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/data.cc +++ b/libinterp/corefcn/data.cc @@ -1771,6 +1771,7 @@ { std::string result_type; + bool all_strings_p = true; bool all_sq_strings_p = true; bool all_dq_strings_p = true; bool all_real_p = true; @@ -1792,6 +1793,8 @@ else result_type = get_concat_class (result_type, args(i).class_name ()); + if (all_strings_p && ! args(i).is_string ()) + all_strings_p = false; if (all_sq_strings_p && ! args(i).is_sq_string ()) all_sq_strings_p = false; if (all_dq_strings_p && ! args(i).is_dq_string ()) @@ -1850,9 +1853,13 @@ { char type = all_dq_strings_p ? '"' : '\''; - maybe_warn_string_concat (all_dq_strings_p, all_sq_strings_p); - - charNDArray result = do_single_type_concat<charNDArray> (args, dim); + if (! all_strings_p) + gripe_implicit_conversion ("Octave:num-to-str", + "numeric", result_type); + else + maybe_warn_string_concat (all_dq_strings_p, all_sq_strings_p); + + charNDArray result = do_single_type_concat<charNDArray> (args, dim); retval = octave_value (result, type); }
--- a/libinterp/parse-tree/pt-mat.cc +++ b/libinterp/parse-tree/pt-mat.cc @@ -31,6 +31,7 @@ #include "data.h" #include "defun.h" #include "error.h" +#include "gripes.h" #include "oct-obj.h" #include "pt-arg-list.h" #include "pt-bp.h" @@ -926,6 +927,7 @@ { octave_value retval = Matrix (); + bool all_strings_p = false; bool all_sq_strings_p = false; bool all_dq_strings_p = false; bool all_empty_p = false; @@ -939,6 +941,7 @@ if (tmp && ! tmp.empty ()) { dim_vector dv = tmp.dims (); + all_strings_p = tmp.all_strings_p (); all_sq_strings_p = tmp.all_sq_strings_p (); all_dq_strings_p = tmp.all_dq_strings_p (); all_empty_p = tmp.all_empty_p (); @@ -983,7 +986,11 @@ { char type = all_dq_strings_p ? '"' : '\''; - maybe_warn_string_concat (all_dq_strings_p, all_sq_strings_p); + if (! all_strings_p) + gripe_implicit_conversion ("Octave:num-to-str", + "numeric", result_type); + else + maybe_warn_string_concat (all_dq_strings_p, all_sq_strings_p); charNDArray result (dv, Vstring_fill_char);