www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3034] New: Template instance name wrongly mangled as LName

reply d-bugmail puremagic.com writes:
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: bugzilla digitalmars.com
        ReportedBy: rsinfu 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: -------
May 28 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3034


Shin Fujishiro <rsinfu gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #384 is|0                           |1
           obsolete|                            |




--- Comment #1 from Shin Fujishiro <rsinfu gmail.com>  2009-06-01 03:07:57 PDT
---
Created an attachment (id=387)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=387)
Fix the problem (DMD 2.030)

I forgot to deal with TemplateMixin. It should be mangled as LName.

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