www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20668] New: Unresolved symbol (array equality) when using

https://issues.dlang.org/show_bug.cgi?id=20668

          Issue ID: 20668
           Summary: Unresolved symbol (array equality) when using separate
                    compilation
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

The following example results in a linker error when every file is compiled
separately:

-------------------------------------------------

module test11931a;

import test11931d;
import test11931b;

class Engine
{
    Signal!void onLeftUp;
}

-------------------------------------------------

module test11931b;

import test11931c;
import test11931d;

class GUIElement
{
    Signal!void onSubmit;
}

-------------------------------------------------

module test11931c;

import test11931a;

-------------------------------------------------

struct Signal(T, A...)
{
    alias D = T delegate();
    D[] _arr;
}

void main() {}

-------------------------------------------------

dmd -m64 -g -L/OPT:NOICF -od=objects -c test11931a.d
dmd -m64 -g -L/OPT:NOICF -od=objects -c test11931b.d
dmd -m64 -g -L/OPT:NOICF -od=objects -c test11931c.d
dmd -m64 -g -L/OPT:NOICF -od=objects -c test11931d.d
dmd -m64 -g -od=objects -of=objects\link11931.exe objects\test11931a.obj
objects\test11931b.obj objects\test11931c.obj objects\test11931d.obj

test11931a.obj : error LNK2019: unresolved external symbol
_D4core8internal5array8equality__T8__equalsTxDFZvTxQgZQuFNaNbNiNfAxQwQeZb
referenced in function
_D10test11931d__T6SignalTvZQk11__xopEqualsFKxSQBs__TQBjTvZQBpKxQsZb
test11931b.obj : error LNK2001: unresolved external symbol
_D4core8internal5array8equality__T8__equalsTxDFZvTxQgZQuFNaNbNiNfAxQwQeZb
objects\link11931.exe : fatal error LNK1120: 1 unresolved externals
Error: linker exited with status 1120

-------------------------------------------------

Missing function:
_D4core8internal5array8equality__T8__equalsTxDFZvTxQgZQuFNaNbNiNfAxQwQeZb
pure nothrow  nogc  safe bool core.internal.array.equality.__equals!(const(void
delegate()), const(void delegate())).__equals(const(void delegate())[],
cols(const(void delegate())[], const(void delegate())[])

Calling function:
_D10test11931d__T6SignalTvZQk11__xopEqualsFKxSQBs__TQBjTvZQBpKxQsZb
bool test11931d.Signal!(void).Signal.__xopEquals(ref
const(test11931d.Signal!(void).Signal), ref
const(test11931d.Signal!(void).Signal))


-------------------------------------------------

This example is reduced from DMDs runnable/link11931.d which fails to compile
if you replace the Phobos imports (filter, array) with dummy templates.

--
Mar 11