www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - redundant definition problem when testing a module that is part of a

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

$DC $(find "src" -iname "*.d") -lib -of"bin/libstyx.a"

$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
Nov 22 2020