This code behaves correctly when compiling with DMD v2.072.0 on Win7. It behaves incorrectly with the same DMD version on OSX. import std.stdio; auto fn(in cdouble value){ writeln(value.re + 0i); // Prints 64+0i return value.re + 0i; } unittest{ writeln(fn(64 + 0i)); // Prints 64+64i, should print 64+0i } It behaves correctly if: If writeln is removed from fn (In the case where I encountered this bug, there was other essential code but no writeln, I don't think this is related to writeln specifically) If an empty out contract is added to fn
I cannot reproduce this. Firstly, cdouble is deprecated so std.complex.Complex should be used instead. Secondly, both using cdouble and Complex the result is 64+0i in both prints. Closing as WORKSFORME.