On Friday, 25 September 2026 at 11:14:50 UTC, DanielG wrote:
```d alias IntFunc = int delegate();void exec(IntFunc[] funcs) {} void main() { int two() => 2; exec(// why do I have to cast to the exact type that exec() already takes?cast(IntFunc[]) [ () => 1, () => two(), ]); } ``` https://slopegame-2.io Without the cast, the error is:Error: ) incompatible types for `(() => 1) : (() => two())`: `int function() pure nothrow @nogc @safe` and `int delegate() pure nothrow @nogc @safe`
This is a classic issue with overload resolution in D. To clean up the code without using an explicit cast, you can wrap the array elements with std.algorithm.map!toDelegate or mark the individual function pointer with toDelegate.
