Bug 9485 – associative array inside struct: intermodule visibility problem

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-08T08:18:00Z
Last change time
2013-02-17T04:57:09Z
Keywords
link-failure
Assigned to
nobody
Creator
atankeev

Comments

Comment #0 by atankeev — 2013-02-08T08:18:13Z
--[ testcase.d ]-- import std.stdio; import somelib; void main() { foo t; t.bar[10] = "bar"; writeln(t); } -- [ EOF ]-- --[ somelib.d ] module somelib; struct foo { string[int] bar; } --[ EOF ]-- $ dmd -c somelib.d $ dmd -c testcase.d $ dmd testcase.o somelib.o testcase.o: In function `_D3std6format61__T11formatValueTS3std5stdio4File17LockingTextWriterTHiAyaTaZ11formatValueFS3std5stdio4File17LockingTextWriterHiAyaKS3std6format18__T10FormatSpecTaZ10FormatSpecZv': testcase.d:(.text._D3std6format61__T11formatValueTS3std5stdio4File17LockingTextWriterTHiAyaTaZ11formatValueFS3std5stdio4File17LockingTextWriterHiAyaKS3std6format18__T10FormatSpecTaZ10FormatSpecZv+0x98): undefined reference to `_D6object28__T16AssociativeArrayTiTAyaZ16AssociativeArray6lengthMFNdZm' collect2: error: ld returned 1 exit status --- errorlevel 1 In LDC it works fine.
Comment #1 by andrej.mitrovich — 2013-02-08T08:19:50Z
Confirmed on win32, only happens with separate compilation.
Comment #2 by andrej.mitrovich — 2013-02-08T17:28:40Z
Very similar to Issue 6744. Both are linker errors about a missing "length" symbol in the associative array.
Comment #3 by k.hara.pg — 2013-02-17T04:57:09Z
*** This issue has been marked as a duplicate of issue 8997 ***