Try compiling following snippet: module sound; import std.math; struct Sound { float time; float delegate(float) func; this(float delegate(float) f, float t) { time = t; func = f; } Sound opAdd(const(Sound) other) { return Sound( (float t){ return func(t) + other.func(t); }, fmax(time, other.time)); } Sound opCat(const(Sound) other) { return Sound( (float t){ if(t <= time) return func(t); return other.func(t - time); }, time + other.time); } } Gives the error message: Internal error: ../ztc/cod4.c 353
Shorter version. struct Sound { int delegate(int) func; this(int delegate(int) f) { } Sound opAdd(const(Sound) other) { return Sound( (int t){ return other.func(0); }); } }
This _might_ be a duplicate of 2560 or 2875.
Even shorter test case: struct S { int q; } void foo(const(S) x) { int delegate(int t) bar = (int t){ return 1 + x.q; }; }
This is another duplicate of 2560. Worked in 2.022. *** This issue has been marked as a duplicate of issue 2560 ***