Jump to page: 1 2
Thread overview
[Issue 14198] [REG2.067a] Link failure with Variant
Feb 19, 2015
Kenji Hara
Mar 04, 2015
Walter Bright
Mar 05, 2015
Walter Bright
Mar 05, 2015
Walter Bright
Mar 05, 2015
Walter Bright
Mar 07, 2015
Kenji Hara
Mar 09, 2015
Kenji Hara
February 19, 2015
https://issues.dlang.org/show_bug.cgi?id=14198

--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> ---
Introduced in: https://github.com/D-Programming-Language/dmd/pull/4335

But i'm not sure what is the problem.

--
March 04, 2015
https://issues.dlang.org/show_bug.cgi?id=14198

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
This reduces to:

---
import std.conv;

struct S
{
    ptrdiff_t function() fptr = &handler;

    static ptrdiff_t handler()
    {
        static if (is(typeof(to!(string)(false))))
        {
            to!(string)(false);
        }
        return 0;
    }

}

void main()
{
}
---
I don't think it has anything to do with 4335, but with emitting instantiations done during a typeof.

--
March 05, 2015
https://issues.dlang.org/show_bug.cgi?id=14198

--- Comment #3 from Walter Bright <bugzilla@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.

--
March 05, 2015
https://issues.dlang.org/show_bug.cgi?id=14198

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
Hmm, a reference to:

  _D3std4conv11__T2toTAyaZ9__T2toTbZ2toFbZAya

is generated, but there's a:

  _D3std4conv11__T2toTAyaZ9__T2toTbZ2toFNaNfbZAya

in Phobos. The difference is the latter is Na (pure) and Nf (@safe).

So, somehow attribute inference is happening in the latter but not the former.

--
March 05, 2015
https://issues.dlang.org/show_bug.cgi?id=14198

--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> ---
https://github.com/D-Programming-Language/phobos/pull/3038

--
March 07, 2015
https://issues.dlang.org/show_bug.cgi?id=14198

--- Comment #6 from Kenji Hara <k.hara.pg@gmail.com> ---
Created attachment 1480
  --> https://issues.dlang.org/attachment.cgi?id=1480&action=edit
Reduced test case. Running ng.bat will reproduce link-failure.

(In reply to Kenji Hara from comment #1)
> Introduced in: https://github.com/D-Programming-Language/dmd/pull/4335

Sorry I was wrong. The issue commit that was introducing the change was in Phobos repository.

https://github.com/D-Programming-Language/phobos/commit/a9d45235da6509e21450dea1825a5fa1dff9eed4#diff-54cf8402b22024ae667d4048a5126f0eL17

The commit has removed `import std.string;` from the module level scope in std.array. Unfortunately it triggered a previously unknown forward reference bug in compiler.

See also the minimized test case I attached.

--
March 07, 2015
https://issues.dlang.org/show_bug.cgi?id=14198

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--
March 07, 2015
https://issues.dlang.org/show_bug.cgi?id=14198

--- Comment #7 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/646dc1969c78fdf43b981b973783efba08b11354 fix Issue 14198 - [REG2.067a] Link failure with Variant

https://github.com/D-Programming-Language/phobos/commit/8598139bde54ffa8e0888b965f11e3ac79914661 Merge pull request #3038 from WalterBright/fix14198

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

--
March 08, 2015
https://issues.dlang.org/show_bug.cgi?id=14198

--- Comment #8 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/77b9b31bb6484c87e45b1df787cd58a4452d05f2 fixup #3038 add reference to bugzilla issue 14198

https://github.com/D-Programming-Language/phobos/commit/74d2c8aa799297ef404055390cbf24c04c94248c Merge pull request #3044 from MartinNowak/fixup3038

fixup #3038 add reference to bugzilla issue 14198

--
March 09, 2015
https://issues.dlang.org/show_bug.cgi?id=14198

Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #9 from Kenji Hara <k.hara.pg@gmail.com> ---
Fix inherent issue in compiler: https://github.com/D-Programming-Language/dmd/pull/4464

--
« First   ‹ Prev
1 2