[Issue 15505] extern(C++) array parameter mangling gains surprise const

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 28 00:31:14 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=15505

--- Comment #5 from Manu <turkeyman at gmail.com> ---
I don't follow your examples:
C++:
  void test(int arg[6]);
  void test(int arg[]);

These are identical in C++, and they should mangle the same; with no size.
And yes, we see that MSVC has `* const` here. This is actually uninteresting,
because there's no way to make a declaration like this in D. In C++, it's just
a lame way to pass an un-sized array, and would almost always just use a
pointer.


This is what's interesting:

C++:
  void test(int (&arg)[6]);
  void test(int (*arg)[6]);

These are interesting because they have meaningful D counterparts:
  void test(ref int[6]);
  void test(int[6]*);

These cases should be fixed in our mangler, they are useful functions that
appear relatively often and are the proper way to pass static-arrays in C++.

--


More information about the Digitalmars-d-bugs mailing list