Sorry, copy+paste error, I of course meant the following :-/...
import std.stdio; class Hugo { public int x = 42; void blah(void function(const Hugo h) f) { f(this); } } void main() { Hugo hugo = new Hugo(); const Hugo inge = hugo; void function(const Hugo h) g = function(const Hugo h) { write("foobar "); writeln(h.x); }; inge.blah(g); }