[Issue 3029] New: Bug in array value mangling rule

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 27 05:40:07 PDT 2009


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

           Summary: Bug in array value mangling rule
           Product: D
           Version: 2.030
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: spec, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: rsinfu at gmail.com


This valid code:
--------------------
module test;
import std.stdio;
struct S(alias init)
{
    int[] content = init;
}
void main()
{
    S!([12, 3]) s1;
    S!([1, 23]) s2;
    writeln(s1.content);
    writeln(s2.content);
}
--------------------
prints wrong values:
--------------------
12 3
12 3
--------------------
The second line should be "1 23", not "12 3".

That is caused by a bug in the current array value mangling rule:
--------------------
Value:
    A Number Value...
--------------------
Under this rule, both S!([12, 3]) and S!([1, 23]) get mangled to the same name
"S4test15__T1SVG2iA2123Z". (Name collision!!!)

There should be delimiters in Values. For example:
--------------------
Value:
    A Number Values

Values:
    Value
    Value _ Values
--------------------

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


More information about the Digitalmars-d-bugs mailing list