www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14429] New: Linker error caused by a combination of multiple

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

          Issue ID: 14429
           Summary: Linker error caused by a combination of multiple
                    factors (static library, inlining, lambda alias and
                    ref parameters)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: link-failure
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: sludwig outerproduct.org

The conditions for triggering this look somewhat complex. The following targets
need to be compiled with -inline:

lib.d
---
void foo(alias F = () => true)()
{
}

void bar()
{
    int _value;
    unescapeStringLiteral(_value);
}

void unescapeStringLiteral(alias F = () => true)(ref int)
{
    // force no-inline, using exceptions or asm { nop; } has the same effect
    static bool x;
}
---

app.d
---
import lib;

void main()
{
    foo();
    bar();
}
---

Building with:
dmd -lib -inline -oflib.a lib.d
dmd -inline app.d lib.a

Results in:
app.o: In Funktion `_Dmain':
app.d:(.text._Dmain+0x12): Nicht definierter Verweis auf
`_D3lib58__T21unescapeStringLiteralS28_D3lib9__lambda6MFNaNbNiNfZbZ21unescapeStringLiteralFNaNbNiNfKiZv'
collect2: error: ld returned 1 exit status
--- errorlevel 1

--
Apr 09 2015