aboutsummaryrefslogtreecommitdiff
path: root/src/comp
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/trans.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 433a8012..3995e1de 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -3046,11 +3046,14 @@ fn trans_if(@block_ctxt cx, @ast.expr cond,
// If we have an else expression, then the entire
// if expression can have a non-nil type.
- // FIXME: Handle dynamic type sizes
auto expr_ty = ty.expr_ty(elexpr);
- expr_llty = type_of(else_res.bcx.fcx.ccx, expr_ty);
- if (ty.type_is_structural(expr_ty)) {
- expr_llty = T_ptr(expr_llty);
+ if (ty.type_has_dynamic_size(expr_ty)) {
+ expr_llty = T_typaram_ptr(cx.fcx.ccx.tn);
+ } else {
+ expr_llty = type_of(else_res.bcx.fcx.ccx, expr_ty);
+ if (ty.type_is_structural(expr_ty)) {
+ expr_llty = T_ptr(expr_llty);
+ }
}
}
case (_) {