When linking with C++ code that uses a negative integer as a template parameter, D will fail to link because it outputs e.g. '-1' instead of 'n1' as required by ABI. Example: C++: template <int x> struct S { int member; }; void func(S<-1> s) {} D: struct S(int x) { int member; } extern(C++) void func(S!(-1) s); void main() { func(S!(-1)(0)); } result: Undefined symbols for architecture x86_64: "__Z4func1SILi-1EE", referenced from: __Dmain in testcpp1.o I don't know what platforms other than OSX this causes a problem on. I am working on a pull that fixes this, will post soon.
PR: https://github.com/D-Programming-Language/dmd/pull/4239
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d60b61437081f3cb1b586af05c1507f1c304753c More proper implementation for parse error on version and debug. Fix issue 13932 -- c++ mangling for template negative int parameter add test case for 13932 https://github.com/D-Programming-Language/dmd/commit/85946f3400b4afdb0a664064c4c79fe3218611bc Fix issue 13932 on Windows as well.
Commits pushed to 2.067 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d60b61437081f3cb1b586af05c1507f1c304753c More proper implementation for parse error on version and debug. https://github.com/D-Programming-Language/dmd/commit/85946f3400b4afdb0a664064c4c79fe3218611bc Fix issue 13932 on Windows as well.