[dmd-internals] Correction to name mangling doc

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


On Aug 31, 2011, at 4:18 PM, Sean Kelly wrote:

> 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


I think I missed an 'H' in there:

_D8demangle24__T3fnAVHbaH2b1a97b0a98Z3fnAFZv



More information about the dmd-internals mailing list