[Issue 5199] New: null implicitly converts to any other type on array assignment

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 10 12:07:48 PST 2010


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

           Summary: null implicitly converts to any other type on array
                    assignment
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2010-11-10 12:06:42 PST ---
The following code compiles and shouldn't:

struct Foo {
    double num;
}

void main() {
    Foo[] foo = new Foo[5];
    foo[] = null;
}

It then fails at runtime with the following nonsensical error message:

object.Exception: lengths don't match for array copy

-- 
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