about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/comp/middle/trans.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index e0d381401e2..8bbd9fa2393 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -3441,8 +3441,15 @@ fn trans_path(@block_ctxt cx, &ast.path p, &option.t[ast.def] dopt,
 
                         auto alloc_result = alloc_ty(cx, tag_ty);
                         auto lltagblob = alloc_result.val;
+
+                        auto lltagty;
+                        if (ty.type_has_dynamic_size(tag_ty)) {
+                            lltagty = T_opaque_tag(cx.fcx.ccx.tn);
+                        } else {
+                            lltagty = type_of(cx.fcx.ccx, tag_ty);
+                        }
                         auto lltagptr = alloc_result.bcx.build.PointerCast(
-                            lltagblob, T_ptr(type_of(cx.fcx.ccx, tag_ty)));
+                            lltagblob, T_ptr(lltagty));
 
                         auto lldiscrimptr = alloc_result.bcx.build.GEP(
                             lltagptr, vec(C_int(0), C_int(0)));