www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4268] New: ambiguous name mangling for local functions

http://d.puremagic.com/issues/show_bug.cgi?id=4268

           Summary: ambiguous name mangling for local functions
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: r.sagitario gmx.de



PDT ---
This code:

module test;

struct struc 
{
    struct fnb {}
}

struc fna()
{
    struct fnb
    {
        static void fnc()
        {
            static struct x {}
            pragma(msg,x.mangleof);
        }
    }
    return struc();
}

struc.fnb fna()
{
    static void fnc()
    {
        static struct x {}
        pragma(msg,x.mangleof);
    }
    return struc.fnb();
}

outputs with "dmd -c test.d"

S4test3fnaFZS4test5struc3fnb3fncFZv1x
S4test3fnaFZS4test5struc3fnb3fncFZv1x

so both functions fnc have the same mangled name.

This seems like a very constructed situation, but it just illustrates that
std.demangle cannot create correct output for local functions if the outer
function returns a qualified type. This happens because there is no seperator
between the return type and the identifier of the local symbol name.

As a result, local functions might not show up correctly in call stacks.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 04 2010