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

           Summary: Implicit cast to immutable from pure function
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-10-07 15:34:46 PDT ---
This program compiles with no errors (DMD 2.056head):


immutable(int[]) foo(in int[2] x) pure {
    return new int[1];
}
void main() {}



While this doesn't compile:


immutable(int[]) foo(in int[] x) pure {
    return new int[1];
}
void main() {}


It gives:
test.d(2): Error: cannot implicitly convert expression (new int[](1u)) of type
int[] to immutable(int[])

I am not sure, but I think the second program too is correct.

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

Reply via email to