mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 07:20:50 +00:00
Fix assigning int to enum or enum to int
Or float, for v6 progs.
This commit is contained in:
parent
83fb588727
commit
49ed4310fd
2 changed files with 7 additions and 1 deletions
|
@ -149,7 +149,12 @@ check_types_compatible (expr_t *dst, expr_t *src)
|
|||
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));
|
||||
expr_t *new = cast_expr (dst_type, src);
|
||||
// the cast was a no-op, so the types are compatible at the
|
||||
// low level (very true for default type <-> enum)
|
||||
if (new != src) {
|
||||
return assign_expr (dst, new);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ int
|
|||
main()
|
||||
{
|
||||
BOOL b;
|
||||
b = 0;
|
||||
b = YES;
|
||||
return !b;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue