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

           Summary: Template instance name wrongly mangled as LName
           Product: D
           Version: 2.030
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: patch, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: rsi...@gmail.com


Created an attachment (id=384)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=384)
Fix the problem (dmd 2.030)

DMD wrongly mangles template instance name as LName, not TemplateInstanceName:
--------------------
module test;
template Temp() { struct S {} }
pragma(msg, Temp!().S.mangleof);
--------------------
S4test9__T4TempZ1S
--------------------

In the above example, DMD mangles the template instance Temp!() to
"9__T4TempZ". Note the preceding number. According to the spec, template
instance name should be mangled without preceding number:
--------------------
SymbolName:
    LName
    TemplateInstanceName

LName:
    Number Name

TemplateInstanceName:
     __T LName TemplateArgs Z
--------------------

This prevents a name demangler from telling the difference between a usual
identifier and template instance name. For example, a demangler can recognize
"9__T4TempZ" as a valid module name, not a template instance.


The proposed patch fixes mangle(Declaration *sthis) and
TemplateInstance::mangle() (mangle.c).

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

Reply via email to