Bug 21678 – "_d_arraysetlengthT is not callable using argument types" on chained array length assignment
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-03-03T22:57:16Z
Last change time
2021-03-13T15:26:26Z
Keywords
pull
Assigned to
No Owner
Creator
Martin Dorey
Comments
Comment #0 by martin.dorey — 2021-03-03T22:57:16Z
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.
Comment #1 by moonlightsentinel — 2021-03-04T00:10:56Z
@BorisCarvajal created dlang/dmd pull request #12249 "Fix Issue 21678 - "_d_arraysetlengthT is not callable using argument …" fixing this issue:
- Fix Issue 21678 - "_d_arraysetlengthT is not callable using argument types" on chained array length assignment
https://github.com/dlang/dmd/pull/12249
Comment #3 by dlang-bot — 2021-03-06T23:19:06Z
dlang/dmd pull request #12249 "Fix Issue 21678 - "_d_arraysetlengthT is not callable using argument …" was merged into stable:
- 3042fa9120f9b112e9639ea449f3ea09bb66330a by Boris Carvajal:
Fix Issue 21678 - "_d_arraysetlengthT is not callable using argument types" on chained array length assignment
https://github.com/dlang/dmd/pull/12249
Comment #4 by dlang-bot — 2021-03-13T15:26:26Z
dlang/dmd pull request #12273 "Merge stable" was merged into master:
- abddd57f0c07c889325ecb5fa1cf2274a802afbc by Boris Carvajal:
Fix Issue 21678 - "_d_arraysetlengthT is not callable using argument types" on chained array length assignment
https://github.com/dlang/dmd/pull/12273