www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21678] New: "_d_arraysetlengthT is not callable using

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

          Issue ID: 21678
           Summary: "_d_arraysetlengthT is not callable using argument
                    types" on chained array length assignment
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: martin.dorey hitachivantara.com

I don't know D but I hope that this is the minimal reproducer:

martind sirius:~/tmp/D147043$ cat D147043.d 
auto F() {
    int[] f;
    int[] a;
    a.length = f.length = 0;
}
martind sirius:~/tmp/D147043$ 

That compiles OK with:

martind sirius:~/tmp/D147043$ dmd --version
DMD64 D Compiler v2.094.2
Copyright (C) 1999-2020 by The D Language Foundation, All Rights Reserved
written by Walter Bright
martind sirius:~/tmp/D147043$ dmd -w -c D147043.d 
martind sirius:~/tmp/D147043$ 

But not with v2.095.0 (I claim but don't show here) or the latest release at
the time of writing:

martind sirius:~/tmp/D147043$ dmd --version
DMD64 D Compiler v2.095.1
Copyright (C) 1999-2020 by The D Language Foundation, All Rights Reserved
written by Walter Bright
martind sirius:~/tmp/D147043$ dmd -w -c D147043.d 
D147043.d(4): Error: function
core.internal.array.capacity._d_arraysetlengthTImpl!(int[],
int)._d_arraysetlengthT(return ref scope int[] arr, ulong newlength) is not
callable using argument types (int[], int[])
D147043.d(4):        cannot pass argument f = f[0..0] of type int[] to
parameter ulong newlength
martind sirius:~/tmp/D147043$ 

Google suggests that this has been seen in the wild in two projects.

--
Mar 03 2021