Summary: multiple definitions with typeid and multiobj
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-08-09 15:43:49 PDT ---
--- tmpl.d:
module tmpl;
struct Tmpl(T) {
  T a;

---- a.d:
module a;
import tmpl;
TypeInfo fun() { return typeid(Tmpl!int()); }

--- b.d:
module b;
import tmpl;
TypeInfo fun() { return typeid(Tmpl!long()); }

--- main.d:
import a, b;
void main() {
  auto t1 =;
  auto t2 =;
  assert(t1 != t2);

dmd -lib -ofliba.a a
dmd -lib -oflibb.a b
dmd main -L-L. -L-la -L-lb

This bug is caused by Type::getTypeInfo causing a call to obj_append while
already being in a deferred genobjfile. The appended symbol is not marked as
doppelganger module thus writes out ModuleAssert, ModuleArray et al. Now two
different libraries can end up with colliding definitions if count in
obj_write_deferred is accidentally the same.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to