[Issue 11648] New: rangeerror when adding element to associative array and value is implicitely converted by alias this

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 30 06:33:27 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11648

           Summary: rangeerror when adding element to associative array
                    and value is implicitely converted by alias this
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: r.sagitario at gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2013-11-30 06:33:16 PST ---
dmd 2.063 compiles and runs this code correctly:

//////////////////
import std.stdio;

struct S
{
    int _payload;
    alias _payload this;
}

void main()
{
    S[string] symbols;
    symbols["a"] = 1; // works if using S(1)
    writeln(symbols); // ["a":1]
}
////////////////

but dmd 2.064 causes a range error when executing:

core.exception.RangeError at test(12): Range violation

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


More information about the Digitalmars-d-bugs mailing list