Bug 21283 – [C++] Wrong mangling for ref of parameter pack

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2020-09-29T06:15:42Z
Last change time
2020-11-16T00:10:07Z
Keywords
C++, industry, pull
Assigned to
No Owner
Creator
Mathias LANG

Comments

Comment #0 by pro.mathias.lang — 2020-09-29T06:15:42Z
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)
Comment #1 by dlang-bot — 2020-10-05T08:09:27Z
@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
Comment #2 by dlang-bot — 2020-10-05T09:11:15Z
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
Comment #3 by dlang-bot — 2020-10-18T03:23:22Z
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
Comment #4 by dlang-bot — 2020-11-16T00:10:07Z
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