On Thursday, September 5, 2019 6:24:07 PM MDT Jamie via Digitalmars-d-learn wrote: > I just picked up some of my old code that was working when I last > used it (approximately 6 months ago) but now is no longer > working. I thought it was due to using an updated compiler, so I > have installed many old compilers in and attempt to make it work, > but no luck. Using DVM I have tried 2.077.0, 2.078.0, 2.079.0, > 2.087.0, 2.088.0, and I think I was using 2.079.0 at the time, > but none of these have worked. The actual issue is: > > /home/jamie/.dvm/compilers/dmd-2.077.0/linux/bin/../../src/phobos/std/math > .d(3702): Error: fmodl cannot be interpreted at compile time, because it > has no available source code called from here: called from here: > fmod(cast(real)to(n), > cast(real)to(2)) > > and > > /home/jamie/.dvm/compilers/dmd-2.077.0/linux/bin/../../src/druntime/import > /object.d(3067): Error: _d_arraysetcapacity cannot be interpreted at > compile time, because it has no available source code called from here: > reserve(i_n, 1LU << cast(int)((p + 1LU) * 1LU)) > > I've looked in the directory it provides and as far as I can tell > the code does exist. I.e. in std.math: > real fmod(real x, real y) @trusted nothrow @nogc > { > version (CRuntime_Microsoft) > { > return x % y; > } > else > return core.stdc.math.fmodl(x, y); > } > > and in core.stdc.math: > /// > double fmod(double x, double y); > /// > float fmodf(float x, float y); > /// > extern(D) real fmodl()(real x, real y) { return > fmod(cast(double) x, cast(double) y); } > > Thanks
Based on that implementation, fmod would work at compile time if you compile on Windows and use Microsoft's runtime instead of Digital Mars runtime (so, if it was compiled as 64-bit or it used whatever the flag is to force the COFF format instead of OMF for 32-bit). It won't work on any other platform at compile time, because core.stdc.math.fmodl is a C function, and C functions cannot be called at compile time. By any chance were you compiling this on Windows previously rather than Linux? If so, that's likely why the code worked before and doesn't now. If you were always compiling on Linux, then I don't know why you were able to compile your code before. A quick glance at the repo history shows that fmod has had that same implementation since 2012, so there should be no way that it was callable on any Linux system even 6 years ago, let alone 6 months ago. - Jonathan M Davis