[qfcc] Get ?: working for references

And spir-v (missed test_expr, and test_expr wasn't dereferencing the
test).
This commit is contained in:
Bill Currie 2025-01-24 14:50:28 +09:00
parent 1e58ca394b
commit e179b10455
2 changed files with 4 additions and 0 deletions

View file

@ -89,6 +89,9 @@ test_expr (const expr_t *e)
}
return error (e, "void has no value");
}
if (is_reference (type)) {
e = pointer_deref (e);
}
e = current_target.test_expr (e);
fold_constants (e);
return edag_add_expr (e);

View file

@ -609,6 +609,7 @@ proc_cond (const expr_t *expr, rua_ctx_t *ctx)
{
scoped_src_loc (expr);
auto test = expr_process (expr->cond.test, ctx);
test = test_expr (test);
auto true_expr = expr_process (expr->cond.true_expr, ctx);
auto false_expr = expr_process (expr->cond.false_expr, ctx);
if (is_error (test)) {