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: bugzi...@digitalmars.com
        ReportedBy: rsi...@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: -------

Reply via email to