const(Class) is mangled as Class const* const
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Mar 27 13:09:35 PDT 2017
On 3/26/2017 3:43 AM, Benjamin Thaut wrote:
> Should I open a bug for this?
It's not a bug, it was intended that way.
The trouble is that D cannot express a <const pointer> to <mutable>. Whichever
way it is mangled will gore someone's ox. D went with the simplest mangling
solution, which is to mangle all C++ const pointers as "head const".
The obvious solution is to implement "head const" in D, but that is a major
change to the type system and the philosophy of D.
I suggest a simpler way - declare the C++ side of the D interface in a way that
matches the way D mangles it. It's always been true that in order to interface D
with C++ you'll need to be a bit flexible on the C++ side.
More information about the Digitalmars-d
mailing list