diff --git a/gen/structs.cpp b/gen/structs.cpp index 8429664d..505bce87 100644 --- a/gen/structs.cpp +++ b/gen/structs.cpp @@ -280,6 +280,13 @@ std::vector DtoStructLiteralValues(const StructDeclaration* sd, co // update offsets lastoffset = os; +#if DMDV2 + // sometimes size of the initializer is less than size of the variable, + // so make sure that lastsize is correct + if (inits[i]->getType()->isSized()) + lastsize = ceil(gTargetData->getTypeSizeInBits(inits[i]->getType()) / 8.0); + else +#endif lastsize = sz; // go to next explicit init