https://issues.dlang.org/show_bug.cgi?id=14894
Martin Nowak <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|mangling of mixins and |mangling of mixins and |lambdas can change w/ |lambdas is not unique and |-unittest or other versions |depends on compilation | |flags Severity|normal |critical --- Comment #8 from Martin Nowak <[email protected]> --- Apparently can also cause calls of the wrong function instead of linker errors, see issue 16994. Different compilations end up with instances of the same mangling. cat > lib.d << CODE alias min = (a, b) => a < b ? a : b; alias max = (a, b) => a > b ? a : b; auto reduce(alias func, T...)(T args) { return func(args); } CODE cat > a.d << CODE import lib; unittest { assert(reduce!min(1, 2) == 1); } CODE cat > b.d << CODE import lib; unittest { assert(reduce!max(1, 2) == 2); } CODE # works dmd -main -unittest -ofmain a.d b.d ./main # fails dmd -unittest -c a.d dmd -unittest -c b.d dmd -main -ofmain a.o b.o // one of the tests calls the wrong reduce ./main ---- $ dmd -unittest -c a.d $ nm a.o | grep lambda 0000000000000000 W _D3lib18__T9__lambda5TiTiZ9__lambda5FNaNbNiNfiiZi 0000000000000000 W _D3lib32__T6reduceS143lib9__lambda5TiTiZ6reduceFNaNbNiNfiiZi $ dmd -unittest -c b.d $ nm b.o | grep lambda 0000000000000000 W _D3lib18__T9__lambda5TiTiZ9__lambda5FNaNbNiNfiiZi 0000000000000000 W _D3lib32__T6reduceS143lib9__lambda5TiTiZ6reduceFNaNbNiNfiiZi --
