[Issue 13742] undefined reference to __coverage

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 7 06:17:37 UTC 2018


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

--- Comment #6 from Martin Nowak <code at dawg.eu> ---
The problem seems to be that the `performLocked!(() => foo);` has a location in
bar.d and tries to increment bar's location, but the bar object is already
emitted.
When objects are done all symbols get reset and further references from other
objects add an external undefined symbol, this seems to trigger the linker bug.

As __coverage is local (static) symbol, referencing it from another object file
isn't possible atm. anyhow.

So I think the root cause is that the compile order bar.d foo.d ends up moving
the nested template function

pure nothrow @nogc @safe void
bar.performLocked!(foo.clear().foo()).performLocked(int)

to the foo.o object, where it can no longer reference bar.d's coverage symbol.

--


More information about the Digitalmars-d-bugs mailing list