const(Class) is mangled as Class const* const

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 26 07:30:00 PDT 2017


On Sunday, 26 March 2017 at 10:43:11 UTC, Benjamin Thaut wrote:
> As you see from the above example D mangles the getClassConst 
> as a "Class const * const" instead of a "Class const *" 
> ("YAQEBV" vs "YAPEBV"). Is this expected behavior?

It's consistent. D's const is transitive, and D doesn't allow you 
to specify const on the indirection of a reference type. So there 
is no problem on the C++ mangling side of things, but, arguably, 
there is one in D's sementic, that isn't new.

Something like differentiating "const(C) i" and "const C i" may 
be a good idea.


More information about the Digitalmars-d mailing list