I'm running into some inexplicable linker errors when trying to compile a project. I've tried two command lines to compile the project that I thought were equivalent except for the names of the output files:

// emptymain.d:
void main(){}

// test.d:
unittest {
    double[double] weights = [1:1.2, 4:2.3];
    import std.stdio;
    writeln("PASSED");
}

dmd -unittest emptymain.d test.d  // Linker errors

dmd -unittest test.d emptymain.d  // Works

Additionally, the linker errors only occur under a custom version of druntime. Don't try to reproduce them under the stock version. (For the curious, it's the precise heap scanning fork from https://github.com/rainers/druntime/tree/precise_gc2 . I'm trying to get precise heap scanning ready for prime time.)

My real question, though, is why should the order of these files on the command line matter and does this suggest a compiler or linker bug?

Reply via email to