[dmd-internals] Correction to name mangling doc

Sean Kelly sean at invisibleduck.org
Wed Aug 31 16:18:43 PDT 2011


Here's one I ran across working on formatting integer literal template parameters.  This declaration:

void fnA(alias x)() {}
alias fnA!([true:'a',false:'b']) fn;

Is mangled as:

_D8demangle24__T3fnAVHbaA2i1i97i0i98Z3fnAFZv

So the template parameter type is "Hba", the list of values is "A2…" and the values themselves are all represented as integers, ie. "i1" for "true", "i97" for "a", etc.  I'm inclined to say that the mangling should reflect the actual type of the values rather than using 'i' as a catch-all.  Does anyone disagree?  Combined with the fix for AA literals, I think the encoding should be:

_D8demangle24__T3fnAVHba2b1a97b0a98Z3fnAFZv


More information about the dmd-internals mailing list