www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24459] New: Missing symbol from partial incremental

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

          Issue ID: 24459
           Summary: Missing symbol from partial incremental compilation.
                    allinst doesn't help.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

Consider three files:

module test1;
import test2;
void main() { A a = A(5); }

module test2;
import test3;
struct A {
    mixin Constructor;
}

module test3;
mixin template Constructor() {
    this()(int i) { }
}

You can build all three in one go:

dmd test1.d test2.d test3.d -oftest

You can also build them incremental:

dmd test1.d test2.d test3.d -od. -c
dmd test1.o test2.o test3.o -oftest

But if you rebuild only test2.d:

dmd test2.d -od. -c

Then the link fails:

/usr/bin/ld: test1.o: in function `_Dmain':
test1.d:(.text._Dmain[_Dmain]+0x16): undefined reference to
`_D5test21A8__mixin1__T6__ctorZQiMFNaNbNcNiNfiZSQBtQBq'

And looking at test2.o, in the first run the constructor is emitted into it
(despite not being called in it!), but when building it in isolation, it is
not.

`-allinst` changes nothing.

--
Mar 27