4 days ago
This is a bug report but I cannot reduce to a simple case.
The problem doesn't happen if I use a simple test library.

test script:

=== bug.sh ===
if [ -z "$DC"  ]; then
    DC=ldmd2
fi
if [ ! -d styx ]; then
    git clone "https://gitlab.com/basile.b/styx.git"
fi
cd styx
# e.g "Compile project" in an IDE
$DC $(find "src" -iname "*.d") -lib -of"bin/libstyx.a"
# e.g "Test current module" in an IDE
$DC "src/styx/lexer.d" "bin/libstyx.a" -I"src" -main -unittest
==============

The following works fine:

  $ DC=dmd sh bug.sh

When using ld2c I got linking errors

  $ DC=ldmd2 sh bug.sh