cppsrc/interop.cpp: ---- template<class T> void foo() { } void test() { foo<int>(); } ---- dsrc/interop.d: ---- extern(C++) void foo(T)(); void main() { foo!int(); } ---- Built with: ---- g++ -c cppsrc/interop.cpp --output=cpp_interop.o dmd dsrc/interop.d cpp_interop.o ---- Output: ---- interop.o: In function `_Dmain': dsrc/interop.d:(.text._Dmain+0x5): undefined reference to `foo<int>::foo()' collect2: error: ld returned 1 exit status --- errorlevel 1 ---- nm --demangle cpp_interop.o: ---- 0000000000000000 W void foo<int>() 0000000000000000 T test() ---- nm --demangle interop.o: ---- ... U foo<int>::foo() ... ---- nm cpp_interop.o: ---- 0000000000000000 W _Z3fooIiEvv 0000000000000000 T _Z4testv ---- nm interop.o: ---- ... U _ZN3fooIiE3fooEv ... ---- Using g++ (GCC) 5.2.0 and DMD git head on Linux. Passing --std=c++11 when compiling the C++ code results in the same mangled names. Using -L-lstdc++ is of course not relevant here either. This is an issue for https://github.com/D-Programming-Language/dlang.org/pull/1154
https://github.com/D-Programming-Language/dmd/pull/5537
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/548c6d1741cead6fcfc813efd34e5adc456ce0cc Fix issue 15372
Commits pushed to master at https://github.com/D-Programming-Language/dlang.org https://github.com/D-Programming-Language/dlang.org/commit/8f03d2745efe0c04c10cb37192c1989f0bef789d Issue 15372: RESOLVED FIXED https://github.com/D-Programming-Language/dlang.org/commit/3bbcd41077e7ee63734399521235157bacd678df Merge pull request #1259 from Bolpat/patch-1 Remove note about Issue 15372 because it was fixed.
Commits pushed to stable at https://github.com/dlang/dlang.org https://github.com/dlang/dlang.org/commit/8f03d2745efe0c04c10cb37192c1989f0bef789d Issue 15372: RESOLVED FIXED https://github.com/dlang/dlang.org/commit/3bbcd41077e7ee63734399521235157bacd678df Merge pull request #1259 from Bolpat/patch-1