Bug 2371 – multiple defenition with templated class enclosing a struct
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2008-09-23T06:14:49Z
Last change time
2019-08-20T11:24:27Z
Keywords
link-failure
Assigned to
No Owner
Creator
Diggory
Comments
Comment #0 by d — 2008-09-23T06:14:49Z
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
Comment #1 by razvan.nitu1305 — 2019-08-20T11:24:27Z