October 14, 2020
https://issues.dlang.org/show_bug.cgi?id=21310

          Issue ID: 21310
           Summary: Itanium C++ mangler handling templated multiple
                    pointer arguments with different type qualifiers
                    incorrectly
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: jamie.border@uq.net.au

Incorrect mangling for templated function with multiple pointer arguments with different type qualifiers.

----
extern(C++) void func(T)(const(T*) a, T* b);

void main()
{
    int i = 0;
    int* pi = &i;
    func(&i, pi);
}
----

This is mangled to
_Z4funcIiEvPKT_S1_
with the dmd Itanium C++ mangler implementation, whereas g++ gets
_Z4funcIiEvPKT_PS0_

Issue seems to be in checking for substitution of args 2 onwards, where it finds a match between const(T*) and T*. Not an issue for non-templated functions.

--