Showing with 14 additions and 3 deletions.
  1. +4 −2 src/todt.c
  2. +10 −1 test/runnable/testdt.d
6 changes: 4 additions & 2 deletions src/todt.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,13 @@ dt_t **Expression_toDt(Expression *e, dt_t **pdt)
pdt = dtnzeros(pdt, vd->offset - offset);
e = (*se->elements)[k];

dt_t *dt = NULL;
Type *tb = vd->type->toBasetype();
if (tb->ty == Tsarray)
toDtElem(((TypeSArray *)tb), pdt, e);
toDtElem(((TypeSArray *)tb), &dt, e);
else
Expression_toDt(e, pdt); // convert e to an initializer dt
Expression_toDt(e, &dt); // convert e to an initializer dt
pdt = dtcat(pdt, dt);

offset = vd->offset + vd->type->size();
}
Expand Down
11 changes: 10 additions & 1 deletion test/runnable/testdt.d
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void test13505()
// 14699

struct S14699a { ubyte[0][10] values; }
struct S14699b { S14699a tbl; }
struct S14699b { S14699a tbl; }
// +/

ubyte[0][1] sa14699;
Expand All @@ -87,6 +87,15 @@ void test14699()
//auto p = &sa14699; // Cannot work in Win32 (OMF)
}

/******************************************/
// 14805

struct S14805
{
ushort one;
}
auto a14805 = new S14805[513*513];

/******************************************/

int main()
Expand Down