Workaround for Voldemort return type handling issues.

See the comment in DtoCallFunction for an explanation of what is
going on.

The struct zero initialization code was also refactored out to
AssignExp::toElem and modified so that it is only triggered
on integer->struct assignments, not for any types where the
modifier-stripped types don't match up. This would have lead to
silently wrong code in the cases where the assert would have been
triggered otherwise.

Fixes the Phobos testsuite build.
This commit is contained in:
David Nadlinger
2012-09-07 03:51:33 +02:00
parent 139e1a9c2a
commit bebc5cce28
3 changed files with 50 additions and 16 deletions
+1 -13
View File
@@ -393,19 +393,7 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op)
Type* t2 = rhs->getType()->toBasetype();
if (t->ty == Tstruct) {
if (!stripModifiers(t)->equals(stripModifiers(t2))) {
// FIXME: use 'rhs' for something !?!
DtoAggrZeroInit(lhs->getLVal());
#if DMDV2
TypeStruct *ts = static_cast<TypeStruct*>(lhs->getType());
if (ts->sym->isNested() && ts->sym->vthis)
DtoResolveNestedContext(loc, ts->sym, lhs->getLVal());
#endif
}
else {
DtoAggrCopy(lhs->getLVal(), rhs->getRVal());
}
DtoAggrCopy(lhs->getLVal(), rhs->getRVal());
}
else if (t->ty == Tarray) {
// lhs is slice