Thread overview
[Issue 19953] extern(C++) const ref to static array incorrectly adds const to the mangle name
Jun 11, 2019
kinke@gmx.net
Jun 11, 2019
kinke@gmx.net
Dec 17, 2022
Iain Buclaw
June 11, 2019
https://issues.dlang.org/show_bug.cgi?id=19953

kinke@gmx.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke@gmx.net

--- Comment #1 from kinke@gmx.net ---
The `const` in the D signature doesn't apply to the reference itself, but to the type, i.e., is the same as `ref const(int[291][6])`, and as such your C++ example isn't an analogon.

Proper analogon with a 1D array, showing that the problem goes somewhat deeper:

C++:          short test27(const int (&)[291]);
Win64 mangle: ?test27@@YAFAEAY0BCD@$$CBH@Z

D:            extern(C++) short test27(const ref int[291])
Win64 mangle: ?test27@@YAFAEBY0BCD@H@Z

--
June 11, 2019
https://issues.dlang.org/show_bug.cgi?id=19953

kinke@gmx.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86                         |All
                 OS|Windows                     |All

--- Comment #2 from kinke@gmx.net ---
Related issue for Linux x64:

C++: short test27(const int (&)[6][291])
     _Z6test27RA6_A291_Ki

D:   extern(C++) short test27(ref const int[291][6])
     _Z6test27RKA6_KA291_Ki

Note that the C++ mangling of `const(int[291][6])` and `const(int)[291][6]` is
identical for both MSVC and Itanium (and that's fine IMO).

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=19953

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--