Bug 8997 – template instances omit symbol that may be used in other modules

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-11T10:16:00Z
Last change time
2014-01-18T18:28:25Z
Keywords
link-failure, pull
Assigned to
nobody
Creator
deadalnix

Comments

Comment #0 by deadalnix — 2012-11-11T10:16:37Z
See cod below : module linkfailclass; class A { A[string] foobar; } module linkfailuse; import linkfailclass; void main() { auto a = new A(); foreach(key; a.foobar.byKey()) { } } Then compile : dmd -c linkfailclass.d dmd -c linkfailuse.d dmd -oflinkfail linkfailclass.o linkfailuse.o linkfailuse.o: In function `_Dmain': linkfailuse.d:(.text._Dmain+0x20): undefined reference to `_D6object45__T16AssociativeArrayTAyaTC13linkfailclass1AZ16AssociativeArray5byKeyMFNdZS6object45__T16AssociativeArrayTAyaTC13linkfailclass1AZ16AssociativeArray5byKeyM6Result' linkfailuse.d:(.text._Dmain+0x29): undefined reference to `_D6object45__T16AssociativeArrayTAyaTC13linkfailclass1AZ16AssociativeArray5Range5emptyMxFNdZb' linkfailuse.d:(.text._Dmain+0x36): undefined reference to `_D6object45__T16AssociativeArrayTAyaTC13linkfailclass1AZ16AssociativeArray5byKeyMFNdZS6object45__T16AssociativeArrayTAyaTC13linkfailclass1AZ16AssociativeArray5byKeyM6Result6Result5frontMFNcNdZAya' linkfailuse.d:(.text._Dmain+0x46): undefined reference to `_D6object45__T16AssociativeArrayTAyaTC13linkfailclass1AZ16AssociativeArray5Range8popFrontMFZv' collect2: error: ld returned 1 exit status --- errorlevel 1 Template is instantiated in linkfailclass so linkfailuse assume it is in it. But some members of the template are not instanciated because not used in linkfailclass. linkfailuse assume they are.
Comment #1 by r.sagitario — 2012-11-23T10:48:01Z
Comment #2 by k.hara.pg — 2013-02-16T21:21:37Z
Comment #3 by k.hara.pg — 2013-02-17T04:57:09Z
*** Issue 9485 has been marked as a duplicate of this issue. ***
Comment #4 by k.hara.pg — 2013-02-17T19:28:18Z
*** Issue 3745 has been marked as a duplicate of this issue. ***
Comment #5 by andrej.mitrovich — 2013-02-18T09:56:09Z
*** Issue 3770 has been marked as a duplicate of this issue. ***
Comment #6 by github-bugzilla — 2013-02-19T07:07:28Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0fa766638dec58fb369554e7ce35799acf0dca08 fix Issue 8997 - template instances omit symbol that may be used in other modules https://github.com/D-Programming-Language/dmd/commit/9154cf1d34252f8fa1b63cf05cc61e3aec213af0 Merge pull request #1667 from 9rnsr/fix8997 Issue 8997 - template instances omit symbol that may be used in other modules