On 03.05.23 13:13, Nick Treleaven wrote:
On Tuesday, 2 May 2023 at 13:06:41 UTC, ag0aep6g wrote:void fun(alias method)(C c) { void delegate() dg; dg.funcptr = &method; dg.ptr = cast(void*) c; dg(); }This also works: void fun(alias method)(C c) { void delegate() dg = &c.method; dg(); }
No, it doesn't. You're not using the alias. You're just accessing `c.method` directly. If the actual method weren't called "method", you'd get an error.