mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Respect struct packing when generating struct initializers.
Fixes issue #88. Previously, invalid code would be generated in cases like the following: --- align(1) struct Test { string str; int id; } Test test = {"asdf", 4}; ---
This commit is contained in:
@@ -388,9 +388,9 @@ LLConstant * IrStruct::createStructInitializer(StructInitializer * si)
|
||||
for (itr = constants.begin(); itr != end; ++itr)
|
||||
types.push_back((*itr)->getType());
|
||||
if (!ltype)
|
||||
ltype = LLStructType::get(gIR->context(), types);
|
||||
ltype = LLStructType::get(gIR->context(), types, packed);
|
||||
else
|
||||
ltype->setBody(types);
|
||||
ltype->setBody(types, packed);
|
||||
}
|
||||
|
||||
// build constant
|
||||
|
||||
Reference in New Issue
Block a user