creal.re and creal.im are not lvalues: is that intentional?
Denis Koroskin
2korden at gmail.com
Thu Oct 22 16:00:23 PDT 2009
For some reason compiler rewrites someComplexVar.re and someComplexVar.im
into cast(real)someComplexVar and cast(ireal)someComplexVar respectively,
which results in those variables being non-lvalues and me being unable to
update either of a properties independently of each other. As one of the
consequences, I can't set imaginary part of a complex variable to
signalling nan:
real snan = real.init; // reals are signalling nans by default
creal c = ...;
//c.im = snan; // doesn't work
c = snan + snan * 1i;
assert(isSignallingNan(c.re)); // pass
assert(isSignallingNan(c.im)); // fail
c = snan + cast(ireal)snan; // doesn't work either
I know complex types are scheduled for deprecation but I'm still confused.
More information about the Digitalmars-d
mailing list