[Issue 21747] New: core.demangle does not understand function-local mangling

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 22 08:02:51 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21747

          Issue ID: 21747
           Summary: core.demangle does not understand function-local
                    mangling
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: pro.mathias.lang at gmail.com

Since the fix for issue 14831, the following code outputs the same value for
mangled and demangled names:
```
import core.demangle;
import std.meta;
import std.stdio;

void main ()
{
    foreach (idx, T; AliasSeq!(int, char, bool, int, string, int, ubyte))
    {
        void checkValue (TT) (TT value, size_t id)
        {
            assert(id == idx);
            assert(value == TT.init);
        }
        checkValue(T.init, idx);
        writeln("  Mangled named: ", checkValue!T.mangleof);
        writeln("Demangled named: ", checkValue!T.mangleof.demangle);
    }
}
```

```
  Mangled named: _D3foo4mainFZ__T10checkValueTiZQpMFNaNbNiNfimZv
Demangled named: pure nothrow @nogc @safe void
foo.main().checkValue!(int).checkValue(int, ulong)
  Mangled named: _D3foo4mainFZ__T10checkValueTaZ5__S1QuMFNaNbNiNfamZv
Demangled named: _D3foo4mainFZ__T10checkValueTaZ5__S1QuMFNaNbNiNfamZv
  Mangled named: _D3foo4mainFZ__T10checkValueTbZ5__S2QuMFNaNbNiNfbmZv
Demangled named: _D3foo4mainFZ__T10checkValueTbZ5__S2QuMFNaNbNiNfbmZv
  Mangled named: _D3foo4mainFZ__T10checkValueTiZ5__S3QuMFNaNbNiNfimZv
Demangled named: _D3foo4mainFZ__T10checkValueTiZ5__S3QuMFNaNbNiNfimZv
  Mangled named: _D3foo4mainFZ__T10checkValueTAyaZ5__S4QwMFNaNbNiNfQvmZv
Demangled named: _D3foo4mainFZ__T10checkValueTAyaZ5__S4QwMFNaNbNiNfQvmZv
  Mangled named: _D3foo4mainFZ__T10checkValueTiZ5__S5QuMFNaNbNiNfimZv
Demangled named: _D3foo4mainFZ__T10checkValueTiZ5__S5QuMFNaNbNiNfimZv
  Mangled named: _D3foo4mainFZ__T10checkValueThZ5__S6QuMFNaNbNiNfhmZv
Demangled named: _D3foo4mainFZ__T10checkValueThZ5__S6QuMFNaNbNiNfhmZv
```

--


More information about the Digitalmars-d-bugs mailing list