C++ code: ``` template<typename T, typename ...Args> void make_shared_poc (Args&... args) {} template void make_shared_poc<int, int, int>(int&, int&); ``` Compiled with `g++ -std=c++11 test.cpp` gives: ``` $ nm test.o 0000000000000000 T __Z15make_shared_pocIiJiiEEvDpRT0_ ``` Now the equivalent D code: ``` extern(C++) void make_shared_poc (T, Args...) (ref Args args); void foobar() { int a, b; make_shared_poc!(int, int, int)(a, b); } ``` Compiled with `dmd -extern-std=c++11 -c test.d` (DMD v2.094.0): ``` U __Z15make_shared_pocIiJiiEEvRDpT0_ ``` Notice that in the C++ code, `R` comes after `Dq` (ref is part of the type), while in the D code, `R` comes before. See https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.function-type : > When a function parameter is a C++11 function parameter pack, its type is mangled with Dp <type>, i.e., its type is a pack expansion: > > <type> ::= Dp <type> # pack expansion (C++11)
@BorisCarvajal updated dlang/dmd pull request #11822 "Fix Issue 21283 - [C++] Wrong mangling for ref of parameter pack" fixing this issue: - Fix Issue 21283 - [C++] Wrong mangling for ref of parameter pack https://github.com/dlang/dmd/pull/11822
dlang/dmd pull request #11822 "Fix Issue 21283 - [C++] Wrong mangling for ref of parameter pack" was merged into stable: - 6b451bc94690a32c96e897020d44029f7f803f7f by Boris Carvajal: Fix Issue 21283 - [C++] Wrong mangling for ref of parameter pack https://github.com/dlang/dmd/pull/11822
dlang/dmd pull request #11845 "merge stable" was merged into master: - b6d97dcfe359956047e6fab59d24403b1589d086 by Boris Carvajal: Fix Issue 21283 - [C++] Wrong mangling for ref of parameter pack https://github.com/dlang/dmd/pull/11845
dlang/dmd pull request #11961 "merge stable" was merged into master: - 6f8b9bf516e2deb6b09653d949e34594c7cf7f7a by Boris Carvajal: Fix Issue 21283 - [C++] Wrong mangling for ref of parameter pack https://github.com/dlang/dmd/pull/11961