#include "observer.h"
#include "objfiles.h"
#include "symtab.h"
+#include "exceptions.h"
extern int overload_debug;
/* Local functions. */
}
if (current_language->c_style_arrays
- && TYPE_CODE (type2) == TYPE_CODE_ARRAY)
+ && TYPE_CODE (type2) == TYPE_CODE_ARRAY
+ && !TYPE_VECTOR (type2))
arg2 = value_coerce_array (arg2);
if (TYPE_CODE (type2) == TYPE_CODE_FUNC)
minus one, instead of biasing the normal case. */
return value_from_longest (type, -1);
}
+ else if (code1 == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && scalar)
+ {
+ /* Widen the scalar to a vector. */
+ struct type *eltype;
+ struct value *val;
+ LONGEST low_bound, high_bound;
+ int i;
+
+ if (!get_array_bounds (type, &low_bound, &high_bound))
+ error (_("Could not determine the vector bounds"));
+
+ eltype = check_typedef (TYPE_TARGET_TYPE (type));
+ arg2 = value_cast (eltype, arg2);
+ val = allocate_value (type);
+
+ for (i = 0; i < high_bound - low_bound + 1; i++)
+ {
+ /* Duplicate the contents of arg2 into the destination vector. */
+ memcpy (value_contents_writeable (val) + (i * TYPE_LENGTH (eltype)),
+ value_contents_all (arg2), TYPE_LENGTH (eltype));
+ }
+ return val;
+ }
else if (TYPE_LENGTH (type) == TYPE_LENGTH (type2))
{
if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
{
val = value_from_longest (type, (LONGEST) 1);
}
+ else if (TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1))
+ {
+ struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type1));
+ int i, n = TYPE_LENGTH (type1) / TYPE_LENGTH (eltype);
+ struct value *tmp;
+
+ val = allocate_value (type);
+ for (i = 0; i < n; i++)
+ {
+ tmp = value_one (eltype, lv);
+ memcpy (value_contents_writeable (val) + i * TYPE_LENGTH (eltype),
+ value_contents_all (tmp), TYPE_LENGTH (eltype));
+ }
+ }
else
{
error (_("Not a numeric type."));
}
if (!v)
- error (_("Structure has no component named %s."), name);
+ throw_error (NOT_FOUND_ERROR,
+ _("Structure has no component named %s."), name);
return v;
}
/* Did we find a match ? */
if (method_oload_champ == -1 && func_oload_champ == -1)
- error (_("No symbol \"%s\" in current context."), name);
+ throw_error (NOT_FOUND_ERROR,
+ _("No symbol \"%s\" in current context."),
+ name);
/* If we have found both a method match and a function
match, find out which one is better, and calculate match
*oload_syms = new_oload_syms;
*oload_champ = new_oload_champ;
*oload_champ_bv = new_oload_champ_bv;
- discard_cleanups (old_cleanups);
+ do_cleanups (old_cleanups);
return 0;
}
}