www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3745] New: Linking error with associative array of arrays

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3745

           Summary: Linking error with associative array of arrays
           Product: D
           Version: 2.039
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: aifgi90 gmail.com


--- Comment #0 from Alexey Ivanov <aifgi90 gmail.com> 2010-01-27 15:02:34 PST
---
--file: a.d--
module a;

class A {
    private int[][int] n;

    public int[][int] foo() {
        return n;
    }
} 
-------------
--file: b.d--
import std.stdio;
import a;

int main() {
    A a = new A();
    if (a.foo().keys.length != 0) {
        foreach (key, value; a.foo()) {
            writefln("%s %s", key, value);
        }
    }
    return 0;
}
-------------
compile:
dmd -c a.d
dmd -c b.d
gcc a.o b.o -lphobos2 -lpthread -lm

...and get errors:
bug.o: In function `_Dmain':
bug.d:(.text._Dmain+0x24): undefined reference to
`_D6object27__T16AssociativeArrayTiTAiZ16AssociativeArray4keysMFNdZAi'
bug.d:(.text._Dmain+0x43): undefined reference to
`_D6object27__T16AssociativeArrayTiTAiZ16AssociativeArray7opApplyMFDFKiKAiZiZi'
collect2: ld returned 1 exit status

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 27 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3745



--- Comment #1 from Alexey Ivanov <aifgi90 gmail.com> 2010-02-15 12:50:16 PST
---
If rewrite a.d as:

module a;

class A {
    private int[][int] n;

    public int[] foo() {
        return n.keys;
    }

    public int[][int] foo() {
        return n;
    }
}

It compiles fine.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 15 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3745


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

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


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2013-02-17 19:28:18 PST ---
*** This issue has been marked as a duplicate of issue 8997 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 17 2013