diff --git a/gen/toir.cpp b/gen/toir.cpp index 88e70c8a..7af6e3f9 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -2403,6 +2403,10 @@ DValue* StructLiteralExp::toElem(IRState* p) { DValue* v = exprs[i]->toElem(p); inits[i] = v->getRVal(); + + // make sure we get inner structs/staticarrays right + if (DtoIsPassedByRef(v->getType())) + inits[i] = DtoLoad(inits[i]); } }