[Issue 14198] [REG2.067a] Link failure with Variant

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Mar 4 21:37:29 PST 2015


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

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
This is crazy complicated.

What's happening is in TemplateInstance::needsCodegen(), the minst for
to!string is set to std.bitmanip, which is not a root module, and so
needsCodegen() says it should be in Phobos.lib. However, std.bitmanip never
actually instantiates to!string, so it is not found in phobos.lib, and the link
fails.

_D3std4conv11__T2toTAyaZ9__T2toTbZ2toFbZAya is to!string

So, to!string's minst is being set wrong.

The wrong value is set by this code in TemplateInstance::semantic():
---------------
// If the first instantiation was speculative, but this is not:
if (!inst->minst)
{
    // Mark it is a non-speculative instantiation.
    inst->minst = minst;  <---- here
}
---------------
minst is set to std.bitmanip during the evaluation of std.bitmanip.FloatRep,
which calls:
--------------
mixin(bitfields!(
          uint,  "fraction", 23,
          ubyte, "exponent",  8,
          bool,  "sign",      1));
---------------
which winds up calling to!string at some point with sc->minst set to
std.bitmanip.

I don't know why to!string is not emitted when Phobos is built.

--


More information about the Digitalmars-d-bugs mailing list