On Tuesday, 24 December 2019 at 13:13:12 UTC, MoonlightSentinel wrote:
On Tuesday, 24 December 2019 at 10:40:16 UTC, Mike Parker wrote:
struct S {}
void f1(S s) {}
void f2(S s) {}

alias Func = immutable(void function());

immutable Func[2] funcs = [cast(Func)&f1, cast(Func)&f2];

Though, it's not clear to me wy the one requires casting the pointer type and the other doesn't.

Because typeof(&f1) == void function(S)

Right. I didn't modify the alias declaration when I took the functions out of the struct. I saw the immutable in the error message and thought that was the problem.

alias Func = void function(S);

Reply via email to