July 17, 2004 DMD 0.95: Anonymous functions are only instantiated once in mixins. | ||||
---|---|---|---|---|
| ||||
This code fails with the errors: foo.d(5): function call (void(*value)(char[]v)) does not match argument types (v oid(*)(int v)) foo.d(5): cannot implicitly convert void(*)(int v) to void(*)(char[]v) It should compile correctly; the anonymous function in foo.func is not being instantiated for each mixin. This is the code: template foo (type) { void func () { call (function void (type v) { }); } } struct tvec (type) { mixin foo! (type); void call (void function (type v) value) { } } tvec! (int) a; tvec! (char []) b; |
Copyright © 1999-2021 by the D Language Foundation