mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-06 19:06:02 +03:00
Fix DMD Issue 3991 - Void initializers in unions considered overlapping
This commit is contained in:
parent
7597808a2d
commit
f6126e7abf
1 changed files with 4 additions and 0 deletions
|
@ -87,6 +87,8 @@ llvm::Constant * IrAggr::getDefaultInit()
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool isAligned(llvm::Type* type, size_t offset) {
|
||||
if (offset == 0)
|
||||
return true;
|
||||
return gDataLayout->getABITypeAlignment(type) % offset == 0;
|
||||
}
|
||||
|
||||
|
@ -278,6 +280,8 @@ void IrAggr::addFieldInitializers(
|
|||
if (data[i].first) continue;
|
||||
|
||||
VarDeclaration* vd = decl->fields[i];
|
||||
if (vd->init && vd->init->isVoidInitializer())
|
||||
continue;
|
||||
|
||||
unsigned vd_begin = vd->offset;
|
||||
unsigned vd_end = vd_begin + vd->type->size();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue