Enforce type consistency for most DValues

At the cost of some more bitcasts.
This commit is contained in:
Martin 2016-07-17 06:20:33 +02:00
parent 88b19d3d51
commit d6dcc7a4db
7 changed files with 78 additions and 99 deletions

View file

@ -590,11 +590,11 @@ void initializeArrayLiteral(IRState *p, ArrayLiteralExp *ale, LLValue *dstMem) {
} else {
// Store the elements one by one.
for (size_t i = 0; i < elemCount; ++i) {
DValue *e = toElem(indexArrayLiteral(ale, i));
DValue *rhs = toElem(indexArrayLiteral(ale, i));
LLValue *elemAddr = DtoGEPi(dstMem, 0, i, "", p->scopebb());
auto vv = new DLValue(e->type, elemAddr);
DtoAssign(ale->loc, vv, e, TOKconstruct, true);
LLValue *lhsPtr = DtoGEPi(dstMem, 0, i, "", p->scopebb());
DLValue lhs(rhs->type, DtoBitCast(lhsPtr, DtoPtrToType(rhs->type)));
DtoAssign(ale->loc, &lhs, rhs, TOKconstruct, true);
}
}
}