www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13359] New: Multiple definition of `format_c_5b3` with three

https://issues.dlang.org/show_bug.cgi?id=13359

          Issue ID: 13359
           Summary: Multiple definition of `format_c_5b3` with three
                    libraries and local imports
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: link-failure, rejects-valid
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: verylonglogin.reg gmail.com

The first library is Phobos, probably `-unittest` switch is needed to use its
local imports. This code should build fine:

m1.d:
---
struct S1 { } // should be before `f1`
void f1() { import std.ascii; }
---
m2.d:
---
struct S2 { } // should be before `f2`
void f2() { import std.ascii; }
---
Command (for Windows):
---
dmd -unittest -lib m1.d
dmd -unittest -lib m2.d m1.lib
---
m2.lib: Error: multiple definition of format_c_5b3: _D9format.1212__ModuleInfoZ
and format: _D9format.1212__ModuleInfoZ
m2.lib: Error: multiple definition of format_c_5b3: __D9format.129__modtestFZv
and format: __D9format.129__modtestFZv
---

This is at least major issue as it breaks building libraries and doesn't give
any clue of its reason.

--
Aug 22 2014