www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3770] New: Associative array with enum key causes link problems when compiled in multiple files

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

           Summary: Associative array with enum key causes link problems
                    when compiled in multiple files
           Product: D
           Version: 2.040
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: webmaster villagersonline.com



08:14:14 PST ---
DMD 2.040
Linux (Fedora) on x86


NOTE: I think that this is a likely dup of 3745.  However, I'm posting this new
defect because it is a new flavor of the problem, just in case the root causes
are somewhat different.


--file: foo.d--
import std.stdio;
import bar;

void main()
{
  foreach(e; ENUM_table.values)
    writef("%d", e);
  foreach(e; ENUM_table.keys)
    writef("%d", e);
}

-------------
--file: bar.d--
enum ENUM : uint {
  INVALID = 256
}

int[ENUM] ENUM_table;

-------------
compile:

dmd -c foo.d
dmd -c bar.d
gcc -m32 foo.o bar.o -L ~/d/2.0/dmd2/linux/lib -lphobos2 -lpthread -lm -o
foobar

-------------
error:

foo.o: In function `_Dmain':
foo.d:(.text._Dmain+0x14): undefined reference to
`_D6object35__T16AssociativeArrayTE3bar4ENUMTiZ16AssociativeArray6valuesMFNdZAi'
foo.d:(.text._Dmain+0x70): undefined reference to
`_D6object35__T16AssociativeArrayTE3bar4ENUMTiZ16AssociativeArray4keysMFNdZAE3bar4ENUM'
collect2: ld returned 1 exit status

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




08:15:22 PST ---
Oh, I forgot to mention: the code works just fine if you concatenate foo.d and
bar.d into a single file.

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


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |DUPLICATE



09:56:09 PST ---
Also fixed by pull in Issue 8997.

*** 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 18 2013