mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 09:00:33 +03:00
Fixed initialization of multidimensional static arrays.
This commit is contained in:
parent
8d7ff66019
commit
d8115713d2
3 changed files with 46 additions and 14 deletions
|
@ -411,12 +411,14 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op)
|
|||
else if (t->ty == Tarray) {
|
||||
// lhs is slice
|
||||
if (DSliceValue* s = lhs->isSlice()) {
|
||||
Type *elemType = t->nextOf()->toBasetype();
|
||||
if (elemType->equals(t2)) {
|
||||
DtoArrayInit(loc, s, rhs, op);
|
||||
if (t->nextOf()->toBasetype()->equals(t2)) {
|
||||
DtoArrayInit(loc, lhs, rhs, op);
|
||||
}
|
||||
#if DMDV2
|
||||
else if (op != -1 && op != TOKblit && arrayNeedsPostblit(elemType)) {
|
||||
else if (DtoArrayElementType(t)->equals(t2)) {
|
||||
DtoArrayInit(loc, s, rhs, op);
|
||||
}
|
||||
else if (op != -1 && op != TOKblit && arrayNeedsPostblit(t)) {
|
||||
DtoArrayAssign(s, rhs, op);
|
||||
}
|
||||
#endif
|
||||
|
@ -446,13 +448,15 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op)
|
|||
}
|
||||
}
|
||||
else if (t->ty == Tsarray) {
|
||||
Type *elemType = t->nextOf()->toBasetype();
|
||||
// T[n] = T
|
||||
if (elemType->equals(t2)) {
|
||||
if (t->nextOf()->toBasetype()->equals(t2)) {
|
||||
DtoArrayInit(loc, lhs, rhs, op);
|
||||
}
|
||||
#if DMDV2
|
||||
else if (op != -1 && op != TOKblit && arrayNeedsPostblit(elemType)) {
|
||||
else if (DtoArrayElementType(t)->equals(t2)) {
|
||||
DtoArrayInit(loc, lhs, rhs, op);
|
||||
}
|
||||
else if (op != -1 && op != TOKblit && arrayNeedsPostblit(t)) {
|
||||
DtoArrayAssign(lhs, rhs, op);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue