void foo(const int i) { }
void bar(int i) { }
Mangles as:
_D4test3fooFxiZv
_D4test3barFiZv
The 'x' is not necessary in the mangling for foo(), as the const would only apply to the internal behavior of foo(), and is not relevant to the caller.
Comment #1 by ag0aep6g — 2019-04-02T21:16:09Z
I suppose these should also mangle the same then:
void foo(const int* p) {}
void bar(const(int)* p) {}
And these, too:
void foo(const int[] p) {}
void bar(const(int)[] p) {}
I.e., remove the top level of const for mangling.
Comment #2 by dlang-bot — 2019-04-04T08:27:35Z
@WalterBright created dlang/dmd pull request #9556 "fix Issue 19785 - top level const types in function parameters should…" fixing this issue:
- fix Issue 19785 - top level const types in function parameters should not mangle as const
https://github.com/dlang/dmd/pull/9556
Comment #3 by bugzilla — 2019-04-04T08:28:27Z
(In reply to ag0aep6g from comment #1)
> I suppose these should also mangle the same then:
Yes.
Comment #4 by robert.schadek — 2024-12-13T19:02:49Z