www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17304] New: [SPEC] Anonymous symbols, show or ignore in

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

          Issue ID: 17304
           Summary: [SPEC] Anonymous symbols, show or ignore in demangler?
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Reduced-ish test:
---
template map(fun...) if (fun.length >= 1)
{
    auto map(Range)(Range r)
    {
        return r;
    }
}

unittest
{
    import std.algorithm.mutation, std.string;
    auto foo(string[] args)
    {
        return args.map!strip;
    }
}
---

Emits the function:

_D9iteration29__T3mapS189iteration005stripZ13__T3mapTAAyaZ3mapFNaNbNiNfAAyaZAAya

Which falls under the following rule twice in the mangling ABI:

SymbolName:
    0             // anonymous symbols


Current behaviour when the GNU binutils D demangler sees the 005, by mostly
fluke, strtol() returns the number 5, which means the two anonymous symbols are
skipped.

This seems to also be the case in the compiler also, as it doesn't should the
internal symbol when compiling with `-v'.

However, should this be assumed the correct way to handle this symbol?  If so
I'll make it explicit.

Otherwise the alternative would be to demangle the symbol as
`iteration.__anonymous.__anonymous.strip'.

--
Apr 07 2017