Link error with template struct on 2.042

Frank Fischer frank-fischer at
Wed Mar 31 00:26:24 PDT 2010


after some time I started again playing with D. The following example
gives an error I don't understand (I'm trying dmd 2.042):

==== main.d ====
import MyMod;

void main()
    MyStruct!(int) s;

==== MyMod.d ===
module MyMod;

struct MyStruct(T) {
    this(this) {}

If I compile the above example with

dmd main.d

I get the following error:

main.o: In function
undefined reference to `_D5MyMod8__assertFiZv'
main.o: In function
undefined reference to `_D5MyMod8__assertFiZv'
collect2: ld returned 1 exit status
--- errorlevel 1

What does this mean? Note that everything works fine if MyStruct is
not a template, if there's no function this(this) or if I compile the
example with assertions disabled like this:

dmd -release main.d

It seems as I'm missing to implement some function, but I don't know

Thanks in advance

More information about the Digitalmars-d-learn mailing list