www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18389] New: Missing interference for nested static arrays

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

          Issue ID: 18389
           Summary: Missing interference for nested static arrays
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

The example below is expected to compile:

void foo(T, size_t a, size_t b)(T[a][b] value) {}

foo([
    [1,2],
    [3,4]
]); // T should be int, a = 2, b = 2. Instead: compile error.

It works when the type of value is known, and when foo isn't a template (which
is just a special case):

foo!(int,2,2)([[1,2],[3,4]]);

But not if any part of the type is missing:

foo!(int, 1)([[1]]);
foo!(1,1)([[1]]); // Move T in the argument list

--
Feb 07