Argon icon indicating copy to clipboard operation
Argon copied to clipboard

_d_arraysetlengthT is not callable using argument types (ArgGroup[], FArgBase[])

Open martindorey opened this issue 3 years ago • 2 comments

martind@sirius:~/download/Argon$ dmd -c argon.d 
argon.d(1782): Error: function core.internal.array.capacity._d_arraysetlengthTImpl!(ArgGroup[], ArgGroup)._d_arraysetlengthT(return ref scope ArgGroup[] arr, ulong newlength) is not callable using argument types (ArgGroup[], FArgBase[])
argon.d(1782):        cannot pass argument this.fargs = this.fargs[0..0] of type FArgBase[] to parameter ulong newlength
martind@sirius:~/download/Argon$ 

The same error has been reported at https://github.com/JellyBrick/MPP-backend-D/issues/1#issuecomment-762268369, suggesting it's nothing to do with Argon or whatever that project is, but rather a problem with a recent dmd. Why, then, am I reporting it here? A friendly audience when I'm rushing at the end of the day. The output I quote was from v2.095.1 but it feels like a regression in dmd v2.095.0 to me. 2.094.2-0 works.

martindorey avatar Mar 03 '21 02:03 martindorey

Despite a private communication suggesting that Markus might prefer me not to, I wanted to get it off my books, so I raised it as https://issues.dlang.org/show_bug.cgi?id=21678 ("_d_arraysetlengthT is not callable using argument types" on chained array length assignment), sorry.

martindorey avatar Mar 03 '21 22:03 martindorey

The same error has been reported at JellyBrick/MPP-backend-D#1 (comment)

How did I contrive not to spot that even the argon.d part was the same? So much for the "two projects" in my upstream report. In which case @JellyBrick might be interested to know that Markus has a work around on the way here, perhaps along the lines of:

martind@sirius:~/download/Argon$ git diff
diff --git a/argon.d b/argon.d
index 22ec6f5..12c422d 100644
--- a/argon.d
+++ b/argon.d
@@ -1778,8 +1778,10 @@ private:
     // object's state can safely be discarded.
 
     auto FreeMemory() {
-        if (!preserve)
-            arg_groups.length = fargs.length = 0;
+        if (!preserve) {
+            arg_groups.length = 0;
+            fargs.length = 0;
+        }
     }
 
     // Assert that the caller hasn't tried to set up a mandatory positional arg
martind@sirius:~/download/Argon$ 

... along with a raft of other changes.

martindorey avatar Mar 03 '21 23:03 martindorey