Fixed casting of the complex types to the imaginary types

This commit is contained in:
Alexey Prokhin
2010-12-30 14:04:40 +03:00
parent ff7198eca8
commit 9aad1ca6d1

View File

@@ -457,7 +457,15 @@ DValue* DtoCastComplex(Loc& loc, DValue* val, Type* _to)
// FIXME: this loads both values, even when we only need one
LLValue* v = val->getRVal();
LLValue* impart = gIR->ir->CreateExtractValue(v, 1, ".im_part");
DImValue* im = new DImValue(to, impart);
Type *extractty;
if (vty->ty == Tcomplex32) {
extractty = Type::timaginary32;
} else if (vty->ty == Tcomplex64) {
extractty = Type::timaginary64;
} else if (vty->ty == Tcomplex80) {
extractty = Type::timaginary80;
}
DImValue* im = new DImValue(extractty, impart);
return DtoCastFloat(loc, im, to);
}
else if (to->ty == Tbool) {