mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-24 12:42:32 +00:00
[qfcc] Improve handling of different types in ?:
This commit is contained in:
parent
2134c85a47
commit
b89e243c47
1 changed files with 14 additions and 1 deletions
|
@ -2484,7 +2484,20 @@ conditional_expr (const expr_t *cond, const expr_t *e1, const expr_t *e2)
|
|||
backpatch (c->boolean.true_list, tlabel);
|
||||
backpatch (c->boolean.false_list, flabel);
|
||||
|
||||
block->block.result = (type1 == type2) ? new_temp_def_expr (type1) : 0;
|
||||
if (!type_same (type1, type2)) {
|
||||
if (!type_assignable (type1, type2)
|
||||
&& !type_assignable (type2, type1)) {
|
||||
type1 = 0;
|
||||
}
|
||||
if (!type_assignable (type1, type2)) {
|
||||
type1 = type2;
|
||||
}
|
||||
if (type_promotes (type2, type1)) {
|
||||
type1 = type2;
|
||||
}
|
||||
}
|
||||
|
||||
block->block.result = type1 ? new_temp_def_expr (type1) : 0;
|
||||
append_expr (block, c);
|
||||
append_expr ((expr_t *) c->boolean.e, flabel);//FIXME cast
|
||||
if (block->block.result)
|
||||
|
|
Loading…
Reference in a new issue