www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13215] New: Error message with static this array assignment

https://issues.dlang.org/show_bug.cgi?id=13215

          Issue ID: 13215
           Summary: Error message with static this array assignment
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

import std.algorithm: map;
import std.array: array;
enum uint N = 10;
immutable uint[2][3] arr1 = [1, 2, 3].map!(x => [x, x]).array; // OK.
immutable uint[2][3] arr2;
static this() {
    arr2 = [1, 2, 3].map!(x => [x, x]).array;
}
void main() {}


dmd 2.066beta5 gives:

test.d(7,39): Error: cannot implicitly convert expression (array(map([1, 2,
3]))) of type int[][] to immutable(uint)[]


But I expect that code to work, or to give an error message like:

test.d(7,39): Error: cannot implicitly convert expression (array(map([1, 2,
3]))) of type int[][] to immutable(uint)[2][]

--
Jul 27 2014