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

--- Comment #0 from 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:
------- You are receiving this mail because: -------

Reply via email to