mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-07 08:21:13 +00:00
Cast scalar types when necessary on assignment
This fixes type promotion errors that broke some tests.
This commit is contained in:
parent
e849c2d1ce
commit
8cef85e5de
1 changed files with 8 additions and 0 deletions
|
@ -142,7 +142,15 @@ check_types_compatible (expr_t *dst, expr_t *src)
|
||||||
type_t *dst_type = get_type (dst);
|
type_t *dst_type = get_type (dst);
|
||||||
type_t *src_type = get_type (src);
|
type_t *src_type = get_type (src);
|
||||||
|
|
||||||
|
if (dst_type == src_type) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (type_assignable (dst_type, src_type)) {
|
if (type_assignable (dst_type, src_type)) {
|
||||||
|
if (is_scalar (dst_type) && is_scalar (src_type)) {
|
||||||
|
// the types are different but cast-compatible
|
||||||
|
return assign_expr (dst, cast_expr (dst_type, src));
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// traditional qcc is a little sloppy
|
// traditional qcc is a little sloppy
|
||||||
|
|
Loading…
Reference in a new issue