mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Default initialize temporary struct generated from struct literal.
This makes sure padding is zeroed out.
This commit is contained in:
@@ -2145,6 +2145,13 @@ DValue* StructLiteralExp::toElem(IRState* p)
|
||||
|
||||
LLValue* sptr = DtoAlloca(llt,"tmpstructliteral");
|
||||
|
||||
// default init the struct to take care of padding
|
||||
// and unspecified members
|
||||
TypeStruct* ts = (TypeStruct*)type;
|
||||
assert(ts->sym);
|
||||
DtoForceConstInitDsymbol(ts->sym);
|
||||
assert(ts->sym->ir.irStruct->init);
|
||||
DtoAggrCopy(sptr, ts->sym->ir.irStruct->init);
|
||||
|
||||
// num elements in literal
|
||||
unsigned n = elements->dim;
|
||||
|
||||
Reference in New Issue
Block a user