www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2371] New: multiple defenition with templated class enclosing a struct

http://d.puremagic.com/issues/show_bug.cgi?id=2371

           Summary: multiple defenition with templated class enclosing a
                    struct
           Product: D
           Version: 1.035
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: link-failure
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: diggory.hardy gmail.com


Given the following 3 files:
----
module A;
import B;
import C;
void main() {
    N!(int) a;
    return 0;
}
----
module B;
import C;
void abc() {
    N!(int) b;
}
----
module C;
class N(T) {
    struct S {}
}
----
These can be compiled and linked successfully like this:
$ dmd -c A.d B.d C.d
$ dmd -ofA A.o B.o C.o

But not like this (or using dsss):
$ dmd -c A.d
$ dmd -c B.d C.d
$ dmd -ofA A.o B.o C.o
B.o:(.rodata+0x0): multiple definition of `_D1C8__T1NTiZ1N1S6__initZ'
A.o:(.rodata+0x0): first defined here
collect2: ld returned 1 exit status
--- errorlevel 1


-- 
Sep 23 2008