Browse Source

Use compound literal storage for ValueDecl lvals

Prior to this commit, if a variable was initialized using a compound
literal, its associated storage would not be set. This commit makes the
variable always take on the storage of the compound literal.

Fixes #2466
J.C. Moyer 2 years ago
parent
commit
4d5a442d1f
1 changed files with 1 additions and 0 deletions
  1. 1 0
      src/llvm_backend_stmt.cpp

+ 1 - 0
src/llvm_backend_stmt.cpp

@@ -2303,6 +2303,7 @@ gb_internal void lb_build_stmt(lbProcedure *p, Ast *node) {
 							lb_add_entity(p->module, e, val);
 							lb_add_debug_local_variable(p, val.value, e->type, e->token);
 							lvals_preused[lval_index] = true;
+							lvals[lval_index] = *comp_lit_addr;
 						}
 					}
 				}