[Issue 17302] New: [SPEC] QualifiedName mangling does not match compiler.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Apr 7 14:44:59 PDT 2017


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

          Issue ID: 17302
           Summary: [SPEC] QualifiedName mangling does not match compiler.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

I think I saw this somewhere, but couldn't find the bug report.

Nested functions have their parent's parameters encoded into the mangle symbol.

---
void foo()
{
    void bar() { }
    pragma(msg, bar.mangleof);
}
---
_D4test3fooFZ3barMFNaNbNiNfZv


Where 'FZ' is inserted between 3foo and 3bar.

This is contrary to the spec (removed irrelevant bits that match template and
internal symbols):

---
MangledName:
    _D QualifiedName M Type

QualifiedName:
    SymbolName
    SymbolName QualifiedName

SymbolName:
    LName

LName:
    Number Name
---


>From the spec, I can only infer that the symbol should be:

_D4test3foo3barMFNaNbNiNfZv

Otherwise a special rule needs to be added to handle functions in SymbolName as
well as TemplateInstanceName.  But that will just cause grammar ambiguities
with LName.


SymbolName:
    FunctionName
    LName

FunctionName:
    Number Name Type

LName:
    Number Name


Well... there's *already* a grammar ambiguity as #14591 is somewhat related.

--


More information about the Digitalmars-d-bugs mailing list