diff --git a/gen/structs.cpp b/gen/structs.cpp index d428f113..78b37212 100644 --- a/gen/structs.cpp +++ b/gen/structs.cpp @@ -271,8 +271,17 @@ std::vector DtoStructLiteralValues(const StructDeclaration* sd, add_zeros(values, os - lastoffset - lastsize); } - // add the expression value - values.push_back(inits[i]); + size_t repCount = 1; + // compute repCount to fill each array dimension + for (Type *varType = var->type; + varType->ty == Tsarray; + varType = varType->nextOf()) + { + repCount *= static_cast(varType)->dim->toUInteger(); + } + + // add the expression values + std::fill_n(std::back_inserter(values), repCount, inits[i]); // update offsets lastoffset = os; diff --git a/tests/d2/dmd-testsuite b/tests/d2/dmd-testsuite index e3b12137..1a32b14f 160000 --- a/tests/d2/dmd-testsuite +++ b/tests/d2/dmd-testsuite @@ -1 +1 @@ -Subproject commit e3b121374e81cd435f1c4c96a35bdb948eb99518 +Subproject commit 1a32b14f563e53559b238c4bdce38ede582881d2