[Issue 6461] New: multiple definitions with typeid and multiobj

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 9 15:43:52 PDT 2011


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

           Summary: multiple definitions with typeid and multiobj
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dawg at dawgfoto.de


--- Comment #0 from dawg at dawgfoto.de 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 = a.fun();
  auto t2 = b.fun();
  assert(t1 != t2);
}

reproduce:
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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list