Thread overview
[Issue 10920] template instantiation order dependent link failure problem
Feb 05, 2015
Kenji Hara
Feb 05, 2015
Kenji Hara
February 05, 2015
https://issues.dlang.org/show_bug.cgi?id=10920

--- Comment #6 from Kenji Hara <k.hara.pg@gmail.com> ---
Sorry, the OP code was not correct. Precise test case is:

// foo.d
import bar;
void main() {
    BitArray ba;
    version(A) pragma(msg, typeof(ba.toString));

    FormatSpec!char fs;
    fs.func();
}

// bar.d
(same with in comment #0)


Command line:
$ dmd foo.d
--> OK

$ dmd -version=A foo.d
void()
OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
foo.obj(foo)
 Error 42: Symbol Undefined
_D3bar18__T10FormatSpecTaZ10FormatSpec4funcMFNaNbNiNfZv
--- errorlevel 1
--> NG

FormatSpec!char is instantiated in both main() and BitArray.toString(). When
-version=A specified, the first instantiation happens in toString(), and its
codegen is wrongly judged to be unnecessary. And the second instantiation is
ignored and link-failure occurs.

It's definitely an issue that depends on the semantic analysis order.

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

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

--
February 13, 2015
https://issues.dlang.org/show_bug.cgi?id=10920

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

https://github.com/D-Programming-Language/dmd/commit/0b695233589c6124a359645137aea803e2fe84e4 fix Issue 10920 - template instantiation order dependent link failure problem

https://github.com/D-Programming-Language/dmd/commit/c4387428c034ae83fa2504379c68ed3ac354d58f Merge pull request #4384 from 9rnsr/fix2644

Issue 2644 & 2500 & 10920 - Unresolved template reference

--
February 13, 2015
https://issues.dlang.org/show_bug.cgi?id=10920

github-bugzilla@puremagic.com changed:

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

--
February 21, 2015
https://issues.dlang.org/show_bug.cgi?id=10920

--- Comment #9 from github-bugzilla@puremagic.com ---
Commits pushed to https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/0b695233589c6124a359645137aea803e2fe84e4 fix Issue 10920 - template instantiation order dependent link failure problem

https://github.com/D-Programming-Language/dmd/commit/c4387428c034ae83fa2504379c68ed3ac354d58f Merge pull request #4384 from 9rnsr/fix2644

--